暴力30分!求调
  • 板块P2089 烤鸡
  • 楼主封禁用户
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/3/13 10:20
  • 上次更新2024/3/13 15:02:22
查看原帖
暴力30分!求调
1064463
封禁用户楼主2024/3/13 10:20
#include<iostream>
using namespace std;
const int n=3;
int main(){
	int asdf,cnt;
	cin>>asdf;
	if(asdf>31||asdf<10) {
		cout<<0;
		return 0;
	}
	for(int a=1;a<=n;a++){
	for(int b=1;b<=n;b++){
	for(int c=1;c<=n;c++){
	for(int d=1;d<=n;d++){
	for(int e=1;e<=n;e++){
	for(int f=1;f<=n;f++){
	for(int g=1;g<=n;g++){
	for(int h=1;h<=n;h++){
	for(int i=1;i<=n;i++){
	for(int j=1;j<=n;j++){
		if(a+b+c+d+e+f+g+h+i+j==asdf) 
			cnt++;
			
	}	
	}	
	}	
	}	
	}	
	}	
	}	
	}	
	}
	}
	cout<<cnt<<'\n';
	for(int a=1;a<=n;a++){
	for(int b=1;b<=n;b++){
	for(int c=1;c<=n;c++){
	for(int d=1;d<=n;d++){
	for(int e=1;e<=n;e++){
	for(int f=1;f<=n;f++){
	for(int g=1;g<=n;g++){
	for(int h=1;h<=n;h++){
	for(int i=1;i<=n;i++){
	for(int j=1;j<=n;j++){
		if(a+b+c+d+e+f+g+h+i+j==asdf) 
			cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<' '<<i<<' '<<j<<' '<<'\n';
			
	}	
	}	
	}	
	}	
	}	
	}	
	}	
	}	
	}
	}
    return 0;
}
2024/3/13 10:20
加载中...