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的更多相关文章
随机推荐
- 在iOS App中增加完整的照片多选功能
转自:http://blog.csdn.net/jasonblog/article/details/8141850 主要参考了ELCImagePickerController,不过由于UI展现上需要定 ...
- Machine Learning—The k-means clustering algorithm
印象笔记同步分享:Machine Learning-The k-means clustering algorithm
- Logstash日志字段拆分grok
参考和测试网站:http://grokdebug.herokuapp.com 例如:test-39.dev.abc-inc.com Mon Apr 24 13:53:58 CST 2017 2017- ...
- 关于液晶显示器的6bit面板、8bit面板及E-IPS(转)
原文:http://bbs.3dmgame.com/thread-2232447-1-1.html 1.什么是6bit面板.8bit面板 众所周知,液晶显示器 ...
- rpc 理解
RPC=Remote Produce Call 是一种技术的概念名词. HTTP是一种协议,RPC可以通过HTTP来实现,也可以通过Socket自己实现一套协议来实现. rpc是一种概念,http也是 ...
- 跟着百度学习之ThinkPHP的认识/初窥
MVC全称(Model View Controller) Model:模型(可以理解位数据库操作模型) View:视图(视图显示) Controller:(控制器) 简单的说框架就是一个类的集合.集合 ...
- mysql5.5和5.6版本间的坑
mysql 5.5 int类型 设置不为null,无填充,添加新数据会自动填充0 而5.6同样的配置新建数据没值时,不让添加 5.5 datetime 不能设置默认时间(可以通过某些复杂的方式,这里说 ...
- love2d 0.9发布
2013年12月13(有点遗憾,一个星期后才知道),love2d终于发布新版本了, 可以直接从我的百度网盘下载. 主要的更新有:(简单翻译自官方论坛说明) LuaJIT: 默认使用LuaJIT,性能大 ...
- PLSQL 连接不上64位ORACLE数据库解决办法
http://it.oyksoft.com/post/6003/ huan jing bian liang TNS_ADMIN D:\OracleClient D:\OracleClient\TNS ...
- php ut8声明
header("Content-type: text/html; charset=utf-8");