第六届省赛C--对称博弈

来源:互联网 发布:江恩矩阵图软件下载 编辑:程序博客网 时间:2024/06/05 18:18

环形,每次取连续1~2个物,取完的赢

以前做过,所以轻松搞定

当N<3时,肯定是最开始先拿的人胜利。因为此时,N==1,N==2,只要拿一次就可以拿完。
       当N>=3时,肯定是第2个拿的人胜利,因为当N为偶数时,不管第1个人,怎么拿,第2个人拿与第一个人同样数量的硬币,且与第1人所拿硬币呈中心对称。最后一定是第2个人胜利。当N为奇数时,在第1轮中,只要第2个人所拿的硬币数与第1个人所拿的硬币数不同,且与第1人所拿硬币呈中心对称。经过第1轮后,就变成了N为偶数的情况一样的了。最后也是第2人胜利。

#include <iostream>

#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;
#define eps 1e-8
struct P
{
    double height;
    double weight;
} p[1000];
int comage(P a,P b)
{
    return a.height<b.height;
}
int main()
{
    int T;
    int n;
    int i;
    double red=0,blue=0;
    cin>>T;
    while(T--)
    {
        cin>>n;
        if(n==1||n==2)
            puts("zbybr");
        else puts("blankcqk");
    }
    return 0;
}
0 0
原创粉丝点击