包子凑数
本文最后更新于 1830 天前,其中的信息可能已经有所发展或是发生改变。
#include<iostream>
using namespace std;
int n;
int arr[105];
int flag=0;
bool judge(int x,int y){
	cout<<"x:"<<x<<"y:"<<y<<endl;
	if(x==1||y==1){
		return true;
	}
	if(x<=0||y<=0||x==y){
		return false;
	}
	int t;
	while(y>0){
		cout<<"x:"<<x<<"y:"<<y<<endl;
		t=x%y;
		x=y;
		y=t;
	}
	if(x==1){
		cout<<"ok"<<endl;
		return true;
	}
	cout<<"no"<<endl;
	return false;
}
void dg(int temp){
	if(temp==0){
		flag=1;
		return ;
	}
	if(temp<0){
		return ;
	}
	for(int i=0;i<n;i++){
		dg(temp-arr[i]);
	}
}
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	int temp1=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(judge(arr[i],arr[j])){
				temp1=1;
				break;	
			}
		}
		if(temp1==1){
			break;
		}	
	}
	if(temp1==0){
		cout<<"INF"<<endl;
	}
	for(int i=1;i<=100;i++){
		flag=0;
		dg(i);
		if(!flag){
			cout<<i<<endl;
		}
	}
	return 0;
}
作者:Yuyy
博客:https://yuyy.info
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇