【hdu 1847】Good Luck in CET-4 Everybody!
来源:互联网 发布:程序员必读书籍 活着 编辑:程序博客网 时间:2024/04/30 03:47
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9161 Accepted Submission(s): 5926
Problem Description
大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是如此。当然,作为在考场浸润了十几载的当代大学生,Kiki和Cici更懂得考前的放松,所谓“张弛有道”就是这个意思。这不,Kiki和Cici在每天晚上休息之前都要玩一会儿扑克牌以放松神经。
“升级”?“双扣”?“红五”?还是“斗地主”?
当然都不是!那多俗啊~
作为计算机学院的学生,Kiki和Cici打牌的时候可没忘记专业,她们打牌的规则是这样的:
1、 总共n张牌;
2、 双方轮流抓牌;
3、 每人每次抓牌的个数只能是2的幂次(即:1,2,4,8,16…)
4、 抓完牌,胜负结果也出来了:最后抓完牌的人为胜者;
假设Kiki和Cici都是足够聪明(其实不用假设,哪有不聪明的学生~),并且每次都是Kiki先抓牌,请问谁能赢呢?
当然,打牌无论谁赢都问题不大,重要的是马上到来的CET-4能有好的状态。
Good luck in CET-4 everybody!
Input
输入数据包含多个测试用例,每个测试用例占一行,包含一个整数n(1<=n<=1000)。
Output
如果Kiki能赢的话,请输出“Kiki”,否则请输出“Cici”,每个实例的输出占一行。
Sample Input
1
3
Sample Output
Kiki
Cici
Author
lcy
Source
ACM Short Term Exam_2007/12/13
【题目链接】:http://acm.hdu.edu.cn/showproblem.php?pid=1847
【题解】
2^0,2^1..2^10…肯定都是必胜态;
则我们只要从那些必负态作为起点,推那些必胜态就可以了(因为该点i是必负的,所以可以推得一个必胜态j,因为j可以变成i,j可以让对方去面临那个必负态了);
【完整代码】
#include <bits/stdc++.h>using namespace std;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define LL long long#define rep1(i,a,b) for (int i = a;i <= b;i++)#define rep2(i,a,b) for (int i = a;i >= b;i--)#define mp make_pair#define pb push_back#define fi first#define se second#define rei(x) scanf("%d",&x)#define rel(x) scanf("%I64d",&x)typedef pair<int,int> pii;typedef pair<LL,LL> pll;const int MAXN = 1e3+100;const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};const double pi = acos(-1.0);int n,two[12];bool bo[MAXN];int main(){ //freopen("F:\\rush.txt","r",stdin); two[0] = 1; rep1(i,1,10) two[i] = two[i-1]<<1; bo[0] = false; rep1(i,0,1000) if (!bo[i]) { rep1(j,0,10) if (i+two[j]<=1000) bo[i+two[j]] = true; } while (scanf("%d",&n)!=EOF) if (bo[n]) puts("Kiki"); else puts("Cici"); return 0;}
- Good Luck in CET-4 Everybody! HDU
- hdu 1847Good Luck in CET-4 Everybody!
- HDU 1847 Good Luck in CET-4 Everybody!
- HDU 1847--Good Luck in CET-4 Everybody!
- hdu 1847 Good Luck in CET-4 Everybody!
- HDU 1847 - Good Luck in CET-4 Everybody!
- HDU 1847 Good Luck in CET-4 Everybody!
- hdu 1847 Good Luck in CET-4 Everybody!
- hdu 1847 Good Luck in CET-4 Everybody! SG定理
- hdu 1847 - Good Luck in CET-4 Everybody!(简单博弈)
- HDU 1847 Good Luck in CET-4 Everybody!
- HDU(1847)Good Luck in CET-4 Everybody!
- HDU 1847 Good Luck in CET-4 Everybody!
- [sg函数] hdu 1847 Good Luck in CET-4 Everybody!
- hdu 1847 Good Luck in CET-4 Everybody!
- HDU-1847-Good Luck in CET-4 Everybody!
- HDU 1847 -Good Luck in CET-4 Everybody! 博弈论
- hdu 1847 Good Luck in CET-4 Everybody!
- ListView的优化使用-抽取ViewHolder以及adapter类
- 20161230 rtlab连接matlab与labview模型(先在word中写的,文字配图全在附件word中)
- mysql 索引 大于等于 走不走索引 最左前缀
- JS循环标签输出
- 星期几
- 【hdu 1847】Good Luck in CET-4 Everybody!
- Android 开发工具之Codota——搜索最好的Android 代码
- 43. Spring Boot动态数据源(多数据源自动切换)【从零开始学Spring Boot】
- 好心态
- Jenkins使用 管理节点
- RecyclerView的NestedScrollingParent
- CollectionView瀑布流添加头视图,自定义Cell计算高度
- h5学习笔记:左右布局
- mysql insert 测试