#19513: AC


ohmygod0193 (2.7182818284590450907955982984...)

學校 : 國立臺灣師範大學附屬高級中學
編號 : 75658
來源 : [223.137.198.149]
最後登入時間 :
2024-01-28 12:04:13
d234. IOI研習營模考1-1新錢錢 -- TOI | From: [61.230.152.55] | 發表日期 : 2019-10-06 11:45

#include<bits/stdc++.h>
using namespace std;
bool f(int a,int b,int k){
	if(k%a==0||k%b==0) return 1;
	int i=k%(a+b);
	if(k==0) return 1;
	if(i>a&&i%a==0) return 1;
	if(i>b&&i%b==0) return 1;
	for(;i<k;i+=a+b){
		if(i%a==0) return 1;
		if(i%b==0) return 1;
	}
	return 0;
}
int main()
{
	int a,b,c,k,t;
	bool m;
	while(cin>>a>>b>>c)
	{
		t=1;
		if (a<b) 
		{
			k=b;b=a;a=k;
		} 
		if(a==1 or b==1) cout<<"Yes"<<endl;
		else if(__gcd(a,b)==1)
		{
			for(int i=c;i<=(a-1)*b;i++)
			{
				m=f(a,b,i);
				if(m==false) {
					cout<<"No"<<endl;t=0;break;
				}
			}
			if(t) cout<<"Yes"<<endl;
			
		}
		else cout<<"No"<<endl;
	}
}
 
ZeroJudge Forum