16 2 1 2 3 1 3 67 1 2 100 1 2 8 6 8 9 6 8 10 6 8 11 6 8 12 6 8 13 6 8 14 6 8 15 6 8 16 6 8 1314 6 8 1994 1 13 1994 7 12
Case #1: Iaka Case #2: Yuwgna Case #3: Yuwgna Case #4: Iaka Case #5: Iaka Case #6: Iaka Case #7: Yuwgna Case #8: Yuwgna Case #9: Iaka Case #10: Iaka Case #11: Yuwgna Case #12: Yuwgna Case #13: Iaka Case #14: Yuwgna Case #15: Iaka Case #16: Iaka
#include <iostream> #include <cstdio> #include <cstring> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <cmath> #include <algorithm> using namespace std; const double eps = 1e-6; const double pi = acos(-1.0); const int INF = 0x3f3f3f3f; const int MOD = 1000000007; #define ll long long #define CL(a,b) memset(a,b,sizeof(a)) int main() { int T,n,a,b; cin>>T; for(int cas=1; cas<=T; cas++) { cin>>n>>a>>b; if(b<a) swap(a, b); cout<<"Case #"<<cas<<": "; int t=__gcd(a, b);//a和b的最大公约数 int cnt; if(a==1)//有1 cnt=n; else { if(t!=1)//不互质 cnt=n/t; else cnt=n; } if(cnt&1) cout<<"Yuwgna"<<endl; else cout<<"Iaka"<<endl; } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
hdu5512 Pagodas(2015ACM/ICPC亚洲区沈阳站-重现赛(感谢东北大学) )
原文:http://blog.csdn.net/d_x_d/article/details/49534679