zoukankan      html  css  js  c++  java
  • hdu 1847 博弈找规律

    http://acm.hdu.edu.cn/showproblem.php?pid=1847

    分析:测试几组数据就看出来了。我自己测试的时候居然推错 了。嗨。(当然还是看出是巴什博弈)

    网上分析:

    找必败点,很容易知道当剩下3时,这是一个必败点,又每一个数减1或减2都可以成为3的倍数,意识到这点大概就会做了,

    因为假如这个n不是3的倍数,那么我们总可以让它减1或减2变成3的倍数,而作为3的倍数对手是不可能一次就拿完的说,这样一直下去…………………………最终先手者一定有机会把它变成3,或是后手者自杀,故意留给先手者2的k次幂,这样就也是胜利者,所以说

    3的倍数就是必败点,http://blog.csdn.net/hzxph/article/details/6660726

    View Code
    // I'm lanjiangzhou
    //C
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <math.h>
    #include <time.h>
    //C++
    #include <iostream>
    #include <algorithm>
    #include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <cctype>
    #include <stack>
    #include <string>
    #include <list>
    #include <queue>
    #include <map>
    #include <vector>
    #include <deque>
    #include <set>
    using namespace std;
    
    //*************************OUTPUT*************************
    #ifdef WIN32
    #define INT64 "%I64d"
    #define UINT64 "%I64u"
    #else
    #define INT64 "%lld"
    #define UINT64 "%llu"
    #endif
    
    //**************************CONSTANT***********************
    #define INF 0x3f3f3f3f
    
    // aply for the memory of the stack
    //#pragma comment (linker, "/STACK:1024000000,1024000000")
    //end
    
    
    int main(){
        int n;
        while(scanf("%d",&n)!=EOF){
            if(n%3==0) printf("Cici\n");
            else printf("Kiki\n");
        }
        return 0;
    }
  • 相关阅读:
    Deepin Linux下安装安卓应用的各种方式
    win下的终端使用指南
    IDEA自定义TODO
    WSL的ssh-agent问题
    MySQL数据类型
    MySQL常用命令.md
    Period 时间坑
    exp/imp管理
    expdp和impdp管理(逻辑导入导出)
    同义词
  • 原文地址:https://www.cnblogs.com/lanjiangzhou/p/3019269.html
Copyright © 2011-2022 走看看