zoukankan      html  css  js  c++  java
  • 博弈论?不存在的

    这篇是博弈论解~(≧▽≦)/~啦啦啦

    感觉还是很妙的

    推荐两个博客

    http://blog.csdn.net/qiankun1993/article/details/6765688

    http://blog.csdn.net/luomingjun12315/article/details/45479073

    感觉自己写不出比他们更好的了,就贴贴代码吧。。。

    poj1704:

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<cmath>
    #include<algorithm>
    #include<iostream>
    #include<string>
    #include<queue>
    #include<map>
    #include<set>
    #include<vector>
    #define mp make_pair
    #define fi first
    #define se second
    #define sqr(x) (x)*(x)
    #define rep(i,x,y) for (int i=(x);i<=(y);i++)
    #define per(i,x,y) for (int i=(x);i>=(y);i--)
    using namespace std;
    typedef long long LL;
    typedef double DBD;
    typedef pair<int,int> pa;
    const int inf=1e9;
    const LL INF=1e18;
    //-----------------------------------------------head-------------------------------------------//
    const int N=100010;
    int T,n,a[N];
    int Write[20];
    int read() {int d=0,f=1; char c=getchar(); while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();} while (c>='0'&&c<='9') d=(d<<3)+(d<<1)+c-48,c=getchar(); return d*f;}
    void write(int x){int t=0; if (x<0) putchar('-'),x=-x; for (;x;x/=10) Write[++t]=x%10; if (!t) putchar('0'); for (int i=t;i>=1;i--) putchar((char)(Write[i]+48));}
    void judge(){freopen(".in","r",stdin); freopen(".out","w",stdout);}
    int main()
    {
        //judge();
        T=read();
        while (T--)
        {
            n=read();
            for (int i=1;i<=n;i++) a[i]=read();
            sort(a+1,a+1+n);
            int ans=0;
            for (int i=n;i>=1;i-=2)
            {
                if (n==1) ans^=a[1]-1;
                else ans^=a[i]-a[i-1]-1;
            }
            if (!ans) puts("Bob will win");
            else puts("Georgia will win");
        }
        return 0;
    }
    View Code

    poj1067:

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<cmath>
    #include<algorithm>
    #include<iostream>
    #include<string>
    #include<queue>
    #include<map>
    #include<set>
    #include<vector>
    #define mp make_pair
    #define fi first
    #define se second
    #define sqr(x) (x)*(x)
    #define rep(i,x,y) for (int i=(x);i<=(y);i++)
    #define per(i,x,y) for (int i=(x);i>=(y);i--)
    using namespace std;
    typedef long long LL;
    typedef double DBD;
    typedef pair<int,int> pa;
    const int inf=1e9;
    const LL INF=1e18;
    //-----------------------------------------------head-------------------------------------------//
    int a,b;
    const DBD q=(sqrt(5.0)+1)/2.0;
    int Write[20];
    int read() {int d=0,f=1; char c=getchar(); while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();} while (c>='0'&&c<='9') d=(d<<3)+(d<<1)+c-48,c=getchar(); return d*f;}
    void write(int x){int t=0; if (x<0) putchar('-'),x=-x; for (;x;x/=10) Write[++t]=x%10; if (!t) putchar('0'); for (int i=t;i>=1;i--) putchar((char)(Write[i]+48));}
    void judge(){freopen(".in","r",stdin); freopen(".out","w",stdout);}
    int wythoff(int a,int b)
    {
        if (a>b) swap(a,b);
        int k=b-a;
        if (a==(int)(k*q)) return 0;
        return 1;
    }
    int main()
    {
        //judge();
        while (scanf("%d%d",&a,&b)!=EOF) {printf("%d
    ",wythoff(a,b));}
        return 0;
    }
    View Code
  • 相关阅读:
    bzoj2733 永无乡 平衡树按秩合并
    bzoj2752 高速公路 线段树
    bzoj1052 覆盖问题 二分答案 dfs
    bzoj1584 打扫卫生 dp
    bzoj1854 游戏 二分图
    bzoj3316 JC loves Mkk 二分答案 单调队列
    bzoj3643 Phi的反函数 数学 搜索
    有一种恐怖,叫大爆搜
    BZOJ3566 概率充电器 概率dp
    一些奇奇怪怪的过题思路
  • 原文地址:https://www.cnblogs.com/lujiaju6555/p/7147486.html
Copyright © 2011-2022 走看看