两个点RE,求大神指点
  • 板块P2089 烤鸡
  • 楼主fox_nice
  • 当前回复4
  • 已保存回复4
  • 发布时间2021/10/15 19:09
  • 上次更新2023/11/4 03:44:53
查看原帖
两个点RE,求大神指点
557823
fox_nice楼主2021/10/15 19:09
#include<iostream>
using namespace std;
int main(){
    int n;
	cin >>n;
	if(n<10||n>30){
		cout<<0;
		return 0;
	} 
	int ans=0;
	for(int i=1;i<=3;i++){
		for(int a=1;a<=3;a++){
			for(int b=1;b<=3;b++){
			    for(int c=1;c<=3;c++){
			        for(int d=1;d<=3;d++){
			            for(int e=1;e<=3;e++){
			                for(int f=1;f<=3;f++){
			                    for(int g=1;g<=3;g++){
			                        for(int h=1;h<=3;h++){
			                        	if(n-i-a-b-c-d-e-f-g-h<=3&&n-i-a-b-c-d-e-f-g-h>=1){
										    ans++;
										}
		                            }
		                        }
		                    }
		                }
		            }
		        }
		    }
		}
	}
	cout<<ans<<endl;
	for(int i=1;i<=3;i++){
		for(int a=1;a<=3;a++){
			for(int b=1;b<=3;b++){
			    for(int c=1;c<=3;c++){
			        for(int d=1;d<=3;d++){
			            for(int e=1;e<=3;e++){
			                for(int f=1;f<=3;f++){
			                    for(int g=1;g<=3;g++){
			                        for(int h=1;h<=3;h++){
			                        	if(n-i-a-b-c-d-e-f-g-h<=3&&n-i-a-b-c-d-e-f-g-h>=1){
			                        		cout<<i<<" "<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<" "<<g<<" "<<h<<" "<<n-i-a-b-c-d-e-f-g-h<<endl;
										}
		                            }
		                        }
		                    }
		                }
		            }
		        }
		    }
		}
	}
	return 0;
}
2021/10/15 19:09
加载中...