HDU 博弈 1846+1847+1849
2016-11-19 20:56
204 查看
题目链接:
1846:http://acm.split.hdu.edu.cn/showproblem.php?pid=1846
1847:http://acm.split.hdu.edu.cn/showproblem.php?pid=1847
1849:http://acm.split.hdu.edu.cn/showproblem.php?pid=1849
代码如下:
1846:(巴什博弈)
1847 :
1849 :(尼姆博弈)
1846:http://acm.split.hdu.edu.cn/showproblem.php?pid=1846
1847:http://acm.split.hdu.edu.cn/showproblem.php?pid=1847
1849:http://acm.split.hdu.edu.cn/showproblem.php?pid=1849
代码如下:
1846:(巴什博弈)
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int t; int a,b; int flag; scanf("%d",&t); while(t--) { flag=0; scanf("%d%d",&a,&b); while(a>=0) { if(a<=b && a>0) flag=1; a=a-b-1; } if(flag) printf("first\n"); else printf("second\n"); } return 0; }
1847 :
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int t; while(~scanf("%d",&t)) { if(t%3==0) { printf("Cici\n"); } else { printf("Kiki\n"); } } return 0; }
1849 :(尼姆博弈)
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int t; int sum=0; int a[1005]; while(scanf("%d",&t),t) { memset(a,0,sizeof(a));sum=0; for(int i=0;i<t;i++) { scanf("%d",&a[i]); sum^=a[i]; } if(sum) printf("Rabbit Win!\n"); else printf("Grass Win!\n"); } return 0; }
相关文章推荐
- 巴什博弈问题 HDU 1846 1847
- hdu 1846 巴什博弈变形
- hdu 1846 Brave Game (巴什博弈)
- hdu 1847 Good Luck in CET-4 Everybody!(基础博弈)
- HDU 1849 Rabbit and Grass 【Nim博弈】
- hdu 1846 Brave Game(博弈)
- hdu 1846 2897 巴什博弈
- HDU-1846-Brave Game【巴什博弈】
- hdu1846(博弈)
- hdu 1847 博弈
- SG函数(hdu 1847 && poj 2960 && 1849)
- HDU 1846 Brave Game(巴什博弈)
- HDU 1847 Good Luck in CET-4 Everybody! 博弈
- hdu 1847(博弈)
- HDU 1846 Brave Game (简单博弈)
- HDU 1847 cet-4 组合博弈
- hdu 1847 Good Luck in CET-4 Everybody!(基础博弈)
- hdu 2149+hdu 1846(巴什博弈)
- HDU 1847 Good Luck in CET-4 Everybody!(博弈)
- HDU 1847 Good Luck in CET-4 Everybody! (巴什博弈)