hdu 1907——John & hdu 2509——Be the Winner
来源:互联网 发布:犀牛软件 垃圾袋 编辑:程序博客网 时间:2024/06/11 09:50
1907:
题意:几堆珠子,每次可以去一堆中的若干个。取到最后一个珠子的人输。问先手能否赢
代码如下:
#include<cstdio>#include<iostream>#include<cstring>using namespace std;int main(){ // freopen("data.txt","r",stdin); int T; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); int d=0; int p=0; for(int i=0;i<n;++i) { int a; scanf("%d",&a); d=d^a; if(a>=2)p++; } if((d==0&&p>=2)||(d&&p==0))puts("Brother"); else puts("John"); }return 0;}
2509:
题意:跟上一题一模一样
代码:
#include<cstdio>#include<iostream>#include<cstring>using namespace std;int main(){ // freopen("data.txt","r",stdin); int n; while(scanf("%d",&n)!=EOF) { int d=0; int p=0; for(int i=0;i<n;++i) { int a; scanf("%d",&a); d=d^a; if(a>=2)p++; } if((d==0&&p>=2)||(d&&p==0))puts("No"); else puts("Yes"); }return 0;}
0 0
- hdu 1907——John & hdu 2509——Be the Winner
- hdu 2509 Be the Winner 1907 John
- hdu 1907 John,hdu 2509 Be the Winner anti-NIM
- HDU(2509) Be the Winner /HDU(1907) John (Nim 博弈)
- HDU 2509 Be the Winner && HDU 1907 John (Nim博弈变形)
- hdu 1907 John / 2509 Be the Winner 博弈 最后取完者为输
- hdu 2509 Be the Winner
- HDU 2509 Be The Winner
- hdu-2509 Be the Winner
- hdu 2509 Be the Winner
- HDU 2509 Be the Winner
- HDU 2509 Be the Winner
- HDU 2509 Be the Winner
- HDU 2509 Be the Winner
- hdu 2509 Be the Winner
- hdu 2509 Be the Winner
- (step8.2.2)hdu 2509(Be the Winner——简单博弈)
- HDU 2509 Be The Winner ( Nim 博弈 )
- primary同步数据到逻辑standby时报违反唯一约束(ora-00001)导致逻辑standby同步停止
- Netty中队列(部分)的处理机制
- 阻塞式Http Server与非阻塞式(异步)HttpServer 示例(基于apache http包构建)
- Lua学习笔记
- 希特勒的演讲
- hdu 1907——John & hdu 2509——Be the Winner
- k-近邻算法的初步研究
- 关联映射
- Lua与Java相互交互的例子
- 决策树算法
- Android开发:性能最佳实践-管理应用内存
- MATLAB——reshape 函数
- 简单实用nginx 配置 本机 虚拟主机 windows 下的。
- Android进程与线程