hdu 5512 Pagodas
来源:互联网 发布:linux更改文件权限例子 编辑:程序博客网 时间:2024/05/17 04:18
Pagodas
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 104 Accepted Submission(s): 84
Problem Description
Two monks, Yuwgna and Iaka, decide to make glories great again. They take turns to build pagodas and Yuwgna takes first. For each turn, one can rebuild a new pagodas labelled
This is a game for them. The monk who can not rebuild a new pagoda will lose the game.
Input
The first line contains an integer t (1≤t≤500) which is the number of test cases.
For each test case, the first line provides the positive integern (2≤n≤20000) and two different integers a and b .
For each test case, the first line provides the positive integer
Output
For each test case, output the winner (``Yuwgna" or ``Iaka"). Both of them will make the best possible decision each time.
Sample Input
162 1 23 1 367 1 2100 1 28 6 89 6 810 6 811 6 812 6 813 6 814 6 815 6 816 6 81314 6 81994 1 131994 7 12
Sample Output
Case #1: IakaCase #2: YuwgnaCase #3: YuwgnaCase #4: IakaCase #5: IakaCase #6: IakaCase #7: YuwgnaCase #8: YuwgnaCase #9: IakaCase #10: IakaCase #11: YuwgnaCase #12: YuwgnaCase #13: IakaCase #14: YuwgnaCase #15: IakaCase #16: Iaka
Source
2015ACM/ICPC亚洲区沈阳站-重现赛(感谢东北大学)
Recommend
wange2014 | We have carefully selected several similar problems for you: 5526 5525 5524 5523 5522
#include<cstdio>#include<string>#include<cstring>#include<iostream>#include<cmath>#include<algorithm>#include<climits>#include<queue>#include<vector>#include<map>#include<sstream>#include<set>#include<stack>#include<cctype>#include<utility>#pragma comment(linker, "/STACK:102400000,102400000")#define PI 3.1415926535897932384626#define eps 1e-10#define sqr(x) ((x)*(x))#define FOR0(i,n) for(int i=0 ;i<(n) ;i++)#define FOR1(i,n) for(int i=1 ;i<=(n) ;i++)#define FORD(i,n) for(int i=(n) ;i>=0 ;i--)#define lson num<<1,le,mid#define rson num<<1|1,mid+1,ri#define MID int mid=(le+ri)>>1#define zero(x)((x>0? x:-x)<1e-15)#define mk make_pair#define _f first#define _s secondusing namespace std;//const int INF= ;typedef long long ll;//const ll inf =1000000000000000;//1e15;//ifstream fin("input.txt");//ofstream fout("output.txt");//fin.close();//fout.close();//freopen("a.in","r",stdin);//freopen("a.out","w",stdout);const int INF =0x3f3f3f3f;//const int maxn= ;//const int maxm= ;int n,a,b;int work(int x,int y){ int z=y-x; if(z==x) return z; if(z>x) swap(z,x); return work(z,x);}int main(){ int T,kase=0;scanf("%d",&T); while(T--) { scanf("%d%d%d",&n,&a,&b); if(a>b) swap(a,b); int mini=work(a,b); int cnt= n/mini-2; printf("Case #%d: ",++kase); if(cnt%2 ==0) puts("Iaka"); else puts("Yuwgna"); } return 0;}
0 0
- HDU 5512 Pagodas
- HDU-5512 Pagodas(GCD)
- hdu 5512 Pagodas
- HDU 5512 Pagodas【博弈】
- HDU 5512 Pagodas
- 【HDU 5512 Pagodas】
- HDU 5512 Pagodas(GCD)
- hdu 5512 Pagodas gcd()
- HDU 5512 Pagodas
- HDU-5512-Pagodas
- HDU 5512 Pagodas (gcd)
- hdu 5512 Pagodas(水题)
- HDU 5512 Pagodas (扩展欧几里德)
- 思维 hdu 5512(Pagodas)
- HDU 5512 Pagodas(分析)
- Pagodas HDU
- HDU-5512-Pagodas【2015沈阳赛区】
- 数论-沈阳站-hdu-5512-Pagodas-水题
- source insight实现快捷键打开文件目录
- UML初识
- Unity3D 单例实现方法(方便简单)
- JavaScript设计模式 Item 3 --封装
- 面试总结2--美团测试面试
- hdu 5512 Pagodas
- nyoj74 进位问题
- SQL和Oracle的区别
- 数据结构实践项目——树和二叉树(2)
- iOS KVC KVO
- jQuery1.9+ 废弃的函数和方法 升级Jquery版本遇到的问题
- Hadoop基础教程之高级编程【自定义每个环节的实现】
- Android ViewFlipper详解
- Html+Css_div中的垂直居中布局