HDU 2509 Be the Winner
2012-04-18 19:31
204 查看
这题Nim博弈;这一就是要考虑全部为1的情况;
View Code
View Code
#include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<set> #include<map> #include<vector> using namespace std; int main( ) { int n ,m,t; while( scanf( "%d",&n )==1 ) { t = 0 ; int flag = 0; while( n -- ) { scanf( "%d" ,&m ); if( m > 1 ) flag = 1; t ^= m; } if( flag ) { if( t== 0 ) puts( "No" ); else puts( "Yes" ); } else { if( t ) puts( "No" ); else puts( "Yes" ); } } //system( "pause" ); return 0; }
相关文章推荐
- [博弈]HDU 2509 Be the Winner
- hdu 2509 Be the Winner
- HDU 2509 Be the Winner && HDU 1907 John (Nim博弈变形)
- HDU-2509-Be the Winner,博弈题~~水过~~
- HDU 2509 Be the Winner (Nim博弈)
- HDU 2509 Be the Winner
- Be the Winner HDU - 2509
- hdu 2509 - Be the Winner(简单博弈)
- HDU 2509 Be the Winner (尼姆博弈)
- HDU 2509 Be the Winner(尼姆模板与hdu 1907类似的题目)
- hdu 1907 John&& hdu 2509 Be the Winner(基础nim博弈)
- HDU(2509) Be the Winner /HDU(1907) John (Nim 博弈)
- HDU2509 Be the Winner 博弈
- HDU 2509 Be the Winner
- HDU 2509 Be The Winner ( Nim 博弈 )
- HDU 2509 Be the Winner(Anti-Nim)
- HDU 2509 Be the Winner(取火柴博弈2)
- HDU 2509 Be the Winner
- hdu 1907——John & hdu 2509——Be the Winner
- (step8.2.2)hdu 2509(Be the Winner——简单博弈)