AC日记——[SHOI2008]小约翰的游戏John bzoj 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=,pos;
bool ok=true;
while(n--)
{
scanf("%d",&pos),ans^=pos;
if(pos!=) ok=false;
}
if ((ok&&!ans)||(!ok&&ans)) printf("John\n");
else printf("Brother\n");
}
return ;
}
AC日记——[SHOI2008]小约翰的游戏John bzoj 1022的更多相关文章
- 1022: [SHOI2008]小约翰的游戏John - BZOJ
Description 小约翰经常和他的哥哥玩一个非常有趣的游戏:桌子上有n堆石子,小约翰和他的哥哥轮流取石子,每个人取的时候,可以随意选择一堆石子,在这堆石子中取走任意多的石子,但不能一粒石子也不取 ...
- 1022: [SHOI2008]小约翰的游戏John【Nim博弈,新生必做的水题】
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2709 Solved: 1726[Submit] ...
- [Bzoj1022][SHOI2008]小约翰的游戏John(博弈论)
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2976 Solved: 1894[Submit] ...
- SHOI2008小约翰的游戏John
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 1139 Solved: 701[Submit][ ...
- bzoj 1022: [SHOI2008]小约翰的游戏John anti_nim游戏
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 1189 Solved: 734[Submit][ ...
- BZOJ 1022 [SHOI2008]小约翰的游戏John
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 1635 Solved: 1036[Submit] ...
- 1022: [SHOI2008]小约翰的游戏John
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 1322 Solved: 829[Submit][ ...
- bzoj千题计划112:bzoj1022: [SHOI2008]小约翰的游戏John
http://www.lydsy.com/JudgeOnline/problem.php?id=1022 http://www.cnblogs.com/TheRoadToTheGold/p/67448 ...
- BZOJ 1022 [SHOI2008]小约翰的游戏John AntiNim游戏
1022: [SHOI2008]小约翰的游戏John Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 1475 Solved: 932[Submit][ ...
随机推荐
- HDU 2135 Rolling table
http://acm.hdu.edu.cn/showproblem.php?pid=2135 Problem Description After the 32nd ACM/ICPC regional ...
- Leader Election
Leader Election Zookeeper的基本操作 Zookeeper虽然是分布式系统,但它并不是为文件存储而设计的,Zookeeper里存储的一般是配置信息和源信息.实际上,Zookeep ...
- ps学习笔记(二)
1)选择所有图层: Ctrl+Alt+A2)查找层:ctrl+alt+shift+f,需要在层面板输入查找层名,可自动查找层:3)隔离层:可将选择图层,更改为隔离,只对选择的层编辑:注:图层面板中有一 ...
- BZOJ4484 JSOI2015最小表示(拓扑排序+bitset)
考虑在每个点的出边中删除哪些.如果其出边所指向的点中存在某点能到达另一点,那么显然指向被到达点的边是没有用的.于是拓扑排序逆序处理,按拓扑序枚举出边,bitset维护可达点集合即可. #include ...
- [ZOJ3899]State Reversing
[ZOJ3899]State Reversing 试题描述 Yakumo Yukari is with no doubt one of the most powerful youkai in Gens ...
- [CF45G]Prime Problem
题目大意:将$1$到$n(1<n\leqslant6000)$分成若干组数,要求每组数的和均为质数,若存在一种分配方式,输出每个数所在的组的编号,有多组解输出任意一组解,若不存在,输出$-1$ ...
- ubuntu下opencv使用cvNamedWindow()和cvShowImage()出错的解决方法
重装系统和opencv,编译运行显示一副图像的程序,报错如下 liurf@liurf-Lenovo-G470:~/WorkSpace/slambook-master/ch5/imageBasics$ ...
- hdu 1520Anniversary party 树形dp入门
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The Un ...
- vue入门知识
vue的特点在于:响应的数据绑定.组合的视图组件. vue的文件,分成三个部分<template>html模板</template> <script>js< ...
- codevs 3305 水果姐逛水果街Ⅱ&&codevs3006
题目描述 Description 水果姐第二天心情也很不错,又来逛水果街. 突然,cgh又出现了.cgh施展了魔法,水果街变成了树结构(店与店之间只有一条唯一的路径). 同样还是n家水果店,编号为1~ ...