• 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;
    }
  • 相关阅读:
    委托与事件
    JSON
    JavascriptBoolean运算符
    SQL执行字符串
    ref和out与SQL中的output
    早绑定、晚绑定
    浅复制和深复制
    Android Fragments 详细使用
    Android 两种为自定义组件添加属性的使用方法和区别
    Gallery 3D+倒影 滑动切换图片示例(转)
  • 原文地址:https://www.cnblogs.com/lanjiangzhou/p/3019269.html
Copyright © 2020-2023  润新知