P2089 烤鸡

P2089 烤鸡 - 洛谷

复制代码
#include<bits/stdc++.h> 
using namespace std;
int n,ans;
int main(){
	cin>>n;
	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++){
				for(int r=1; r<=3; r++){
				for(int w=1; w<=3; w++){
				if(a+b+c+d+e+f+g+h+r+w==n){
					ans++;
				}
			  }
			  }
			  }
			  }
			         }
			       }
			    }
			}
		}
	}
	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++){
				for(int r=1; r<=3; r++){
				for(int w=1; w<=3; w++){
				if(a+b+c+d+e+f+g+h+r+w==n){
					cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<" "<<g<<" "<<h<<" "<<r<<" "<<w<<" "<<endl;
				}
			  }
			  }
			  }
			  }
			         }
			       }
			    }
			}
		}
	}
	
	return 0;
} 
相关推荐
apocelipes19 小时前
常用编程语言和库的正则表达式性能对比
c语言·c++·python·性能优化·golang·开发工具和环境
HjhIron20 小时前
面试常客:字符串算法从入门到进阶
算法·面试
吴佳浩1 天前
DeepSeek DSpark:Confidence-Scheduled Speculative Decoding 技术解析
人工智能·算法·deepseek
触底反弹1 天前
🧠 搞懂 Token,才算真正入门大模型——从分词原理到 Embedding 语义实战
javascript·人工智能·算法
vivo互联网技术1 天前
ICLR 2026 | 基于后验采样的图像恢复方法LearnIR:人脸去阴影、去雾
人工智能·算法·aigc
浮生望1 天前
JS字符串与回文算法:从包装类到双指针的面试进阶之路
javascript·算法
黄敬峰1 天前
面试必刷:从JS底层包装类到双指针,彻底搞懂字符串与回文算法
算法
地平线开发者2 天前
J6B vio scenario sample
算法
BothSavage2 天前
Trae远程开发中DeepSeek自定义模型4054错误的排查与修复
算法