HDU_5512_Pagodas
Pagodas
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2045 Accepted Submission(s): 1405
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 i (i∉{a,b} and 1≤i≤n) if there exist two pagodas standing erect, labelled j and k respectively, such that i=j+k or i=j−k. Each pagoda can not be rebuilt twice.
This is a game for them. The monk who can not rebuild a new pagoda will lose the game.
For each test case, the first line provides the positive integer n (2≤n≤20000) and two different integers a and b.
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 #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
- 签到数论题
- 求gcd(a,b)=d,如果a和b互质则可以到达每个位置,否则总共到达位置数量为n/d
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
typedef long long LL ;
typedef unsigned long long ULL ;
const int maxn = 1e5 + ;
const int inf = 0x3f3f3f3f ;
const int npos = - ;
const int mod = 1e9 + ;
const int mxx = + ;
const double eps = 1e- ;
const double PI = acos(-1.0) ; int gcd(int x, int y){
return y?gcd(y,x%y):x;
}
int T, n, a, b, c, d, Yuwgna;
int main(){
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
while(~scanf("%d",&T)){
for(int kase=;kase<=T;kase++){
scanf("%d %d %d",&n,&a,&b);
d=gcd(a,b);
c=(n/d)-;
Yuwgna=c&;
printf("Case #%d: %s\n",kase,Yuwgna?"Yuwgna":"Iaka");
}
}
return ;
}
HDU_5512_Pagodas的更多相关文章
随机推荐
- verilog之四位全加器的编译及仿真(用开源免费的软件——iverilog+GTKWave)
verilog之四位全加器的编译及仿真(用开源免费的软件——iverilog+GTKWave) 四位全加器的verilog的代码比比皆是,这里上一个比较简单的: /* 4位全加器全加器需要有输入输出, ...
- 每日英语:China Targets Big Pharma
China unveiled a litany of bribery and misconduct allegations against GlaxoSmithKline GSK.LN -0.26% ...
- tomcat开启https协议
1.在tomcat的conf/server.xml 中配置 <Connector port="443" protocol="org.apache.coyote.ht ...
- bash之局部变量与子shell(转载)
shell是每个接触linux.unix用户不得不会的工具,谈到shell就又联系到bash,因为这个shell是普遍被使用的.那么bash中的局部变量和子shell你是否能熟练掌握呢?这里推荐一本学 ...
- zepto中的tap穿透
有一个项目,浮层上是有点击的按钮,但是用tap就会穿透,触发浮层下的页面的点击事件.后来问同事和经过自己尝试,发现用click就可以解决这个问题.
- lua获取喜马拉雅音频地址
参考此文http://blog.csdn.net/zjg555543/article/details/39177971 在Linux下可以直接运行 #!/usr/bin/lua5. --需要luacu ...
- 用swift开发仪表盘控件(二)
二.代码分析 这个控件本质就是从UIView继承的一个类而已.所以整个代码事实上就是一个定制的UIView类. 依据UIView的规则进行例如以下初始化: required init(coder aD ...
- 修改ElasticSearch默认的from size
2016年04月07日 17:04:17 阅读数:8065 如果需要搜索分页,可以通过from size组合来进行.from表示从第几行开始,size表示查询多少条文档.from默认为0,size默认 ...
- jackson 不拼null节点的注解
http://blog.sina.com.cn/s/blog_544a7be401011url.html ——————————————————————————————————————————————— ...
- imx6 android SD卡启动
工作中需要将imx6的android系统从SD卡启动,所以就分析了MfgTool中的脚本,分析android的分区情况,并尝试自己操作,竟然成功了,记录于此. 参考文档 http://www.kanc ...