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][ ...
随机推荐
- 牛客网(string::find()函数回忆一下)
链接:https://www.nowcoder.com/acm/contest/109/B来源:牛客网 给出两个串s和x 定义s中的某一位i为好的位置,当且仅当存在s的子序列 满足y=x且存在j使得i ...
- [剑指Offer] 14.链表中倒数第k个结点
[思路]利用两个相隔为k-1个结点的指针进行遍历,当后一个指针移到末尾时,前一个指针就是要求的结点. /* struct ListNode { int val; struct ListNode *ne ...
- ES 1.7安装ik分词elasticsearch-analysis-ik-1.2.5
IK简介 https://www.cnblogs.com/yjf512/p/4789239.html https://www.cnblogs.com/xing901022/p/5910139.html ...
- 根据约束id名找到表名
数据库运行删除某条数据出现 [Err] ORA-02292: 违反完整约束条件 (ITOUCH_FDA.FKC7DB45E29C5A81ED) - 已找到子集 根据ITOUCH_FDA.FKC7DB4 ...
- bcc
#include<bits/stdc++.h> using namespace std; #define mxn 510 struct E{ int from,to; }; int dfn ...
- POJ2236:Wireless Network(并查集)
Wireless Network Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 39772 Accepted: 164 ...
- C#弱引用
加菲猫 Just have a little faith. C#弱引用 .NET框架提供了另一有趣的特色,被用于实现多样的高速缓存.在.NET中弱引用通过System.WeakReference类实现 ...
- PHP代码优化小笔记
1.十万级以上次执行情况,方法可以被静态化,考虑声明为静态.html静态页面速度更快 2.echo 替换print:echo时逗号连接符替换点号连接符 3.循环之前设置循环最大次数,循环参数不要使用函 ...
- Redis(1) 初识Redis
redis介绍: Redis是一个开源(BSD许可)的内存数据结构存储,用作数据库,缓存和消息代理.它支持数据结构,如字符串(String),哈希(Hash),列表(List),集合(Set),具有范 ...
- BZOJ 2063: 我爸是李刚
2063: 我爸是李刚 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 155 Solved: 82[Submit][Status][Discuss] ...