博弈论?不存在的

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了博弈论?不存在的相关的知识,希望对你有一定的参考价值。

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

感觉还是很妙的

推荐两个博客

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\n",wythoff(a,b));}
    return 0;
}
View Code

以上是关于博弈论?不存在的的主要内容,如果未能解决你的问题,请参考以下文章

以下是一个博弈的标准式,用重复剔除占优策略的方法来求该博弈的解?

有人可以在快速数组中给出“如果不存在则追加”方法的片段吗?

PHP常用代码片段

AtCoder AGC033C Removing Coins (博弈论)

BZOJ3759: Hungergame 博弈论+线性基

5.10 省选模拟赛 拍卖 博弈 dp