首页 > 其他 > 详细

AC日记——[SHOI2008]小约翰的游戏John bzoj 1022

时间:2017-05-17 11:35:40      阅读:254      评论:0      收藏:0      [点我收藏+]

1022

 

思路:

  nim;

 

代码:

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int T;
    scanf("%d",&T);
    while (T--)
    {
        int n;
        scanf("%d",&n);
        int ans=0,pos;
        bool ok=true;
        while(n--)
        {
            scanf("%d",&pos),ans^=pos;
            if(pos!=1) ok=false;
        }
        if ((ok&&!ans)||(!ok&&ans)) printf("John\n");
        else printf("Brother\n");
    }
    return 0;
}

 

AC日记——[SHOI2008]小约翰的游戏John bzoj 1022

原文:http://www.cnblogs.com/IUUUUUUUskyyy/p/6866109.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!