• HDU 1847 【巴什博弈】


    Good Luck in CET-4 Everybody!
    Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 12422 Accepted Submission(s): 8056

    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
    【分析】:
    如果你是先手,那么请考虑你的必胜点。由于规定只能去2的幂次,那么只要你留给对手的牌数为3的倍数时,那么你就必赢,因为留下3的倍数时,对手有两种情况:1,要么取剩下1,给你胜利 2,要么对手取了一点点儿,轮到你时,你就又可以构造一个3的倍数了嘛。
    所以无论哪种情况,当你留给对手为3N的时候,你是必胜的。好吧,题目说你就是Kiki,那么当牌数为3的倍数时,Kiki就输了。因为一出来,上帝就留给了Kiki一个3的倍数。没办法,但是如果一开始上帝留给Kiki的不是3的倍数,那么Kiki肯定能够用先手的优势构造出3的倍数,那么Kiki就必胜。所以代码是异常的简单啊。
    【代码】:

    #include<cstdio>
    #include<string>
    #include<cstdlib>
    #include<cmath>
    #include<iostream>
    #include<cstring>
    #include<set>
    #include<queue>
    #include<algorithm>
    #include<vector>
    #include<map>
    #include<cctype>
    #include<stack>
    #include<sstream>
    #include<list>
    #include<assert.h>
    #include<bitset>
    #include<numeric>
    #define debug() puts("++++")
    #define gcd(a,b) __gcd(a,b)
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define fi first
    #define se second
    #define pb push_back
    #define sqr(x) ((x)*(x))
    #define ms(a,b) memset(a,b,sizeof(a))
    #define sz size()
    #define be begin()
    #define pu push_up
    #define pd push_down
    #define cl clear()
    #define lowbit(x) -x&x
    #define all 1,n,1
    #define rep(i,a,b) for(int i=(a); i<(b); i++)
    #define in freopen("in.in","r",stdin)
    #define out freopen("out.out","w",stdout)
    //#define mod 1000000007
    using namespace std;
    typedef long long LL;
    typedef unsigned long long ULL;
    typedef pair<int,int> P;
    const int INF = 0x3f3f3f3f;
    const LL LNF = 1e18;
    const int maxn = 1e5 + 20;
    const int maxm = 1e6 + 10;
    const double PI = acos(-1.0);
    const double eps = 1e-8;
    const int dx[] = {-1,1,0,0,1,1,-1,-1};
    const int dy[] = {0,0,1,-1,1,-1,1,-1};
    const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    #define ll long long
    int main()
    {
        int t;
        while(cin>>t)
        {
            if(t%3!=0) cout<<"Kiki"<<endl;
            else cout<<"Cici"<<endl;
        }
        return 0;
    }
    
  • 相关阅读:
    codeforces——模拟
    线段树水题
    编码格式分类: 前后端传递数据的编码格式contentType
    爬虫之爬取求职小网站
    auth 模块使用篇
    后端获取前端的多个数据用getlist
    字符串值的替换
    单例的5种开启方式
    forms 组件的功能和使用
    cookie和session 的初步介绍
  • 原文地址:https://www.cnblogs.com/Roni-i/p/9085166.html
Copyright © 2020-2023  润新知