随笔分类 -  博弈

hdu1850
摘要:题意要求除了对输赢的判断,还有对第一次取法的计数。所以先要对状态做判断,至于取法则是要看每堆扑克牌与异或结果最高位对应的位上是否为1. 1 #include <algorithm> 2 #include <iostream> 3 #include <iomanip> 4 #include <cstring> 5 #include <cstdlib> 6 #include <climits> 7 #include <sstream> 8 #include <fstream> 9 #include &l 阅读全文
posted @ 2013-06-11 20:44 Ac_国士无双 阅读(138) 评论(0) 推荐(0)
hdu2147
摘要:题不难,看题意的时候把自己坑了,还以为是威佐夫博奕,其实直接求SG值,规律很好找。 1 #include<stdio.h> 2 int main() 3 { 4 int n,m; 5 while(scanf("%d%d",&n,&m)!=EOF) 6 { 7 if(n==0&&m==0) 8 break; 9 if(m&1&&n&1)10 printf("What a pity!\n");11 else12 printf("Wonderful!\n");1.. 阅读全文
posted @ 2013-06-11 18:29 Ac_国士无双 阅读(112) 评论(0) 推荐(0)
hdu2149
摘要:巴什博奕,简单题 1 #include<stdio.h> 2 int main() 3 { 4 int m,n,s,i; 5 while(scanf("%d%d",&m,&n)!=EOF) 6 { 7 if(n>=m) 8 { 9 for(i=m;i<n;i++)10 printf("%d ",i);11 printf("%d\n",i);12 continue;13 }14 s=m%(n+1);15 ... 阅读全文
posted @ 2013-06-11 18:26 Ac_国士无双 阅读(158) 评论(0) 推荐(0)
hdu1847
摘要:博弈,求SG值 1 #include<stdio.h> 2 int main() 3 { 4 int n; 5 while(scanf("%d",&n)!=EOF) 6 { 7 if(n%3==0) 8 printf("Cici\n"); 9 else10 printf("Kiki\n");11 }12 return 0;13 } 阅读全文
posted @ 2013-06-10 17:04 Ac_国士无双 阅读(115) 评论(0) 推荐(0)
hdu1846
摘要:博弈,水题#include<stdio.h>int main(){ int c,n,m; scanf("%d",&c); while(c--) { scanf("%d%d",&n,&m); if(n%(m+1)==0) printf("second\n"); else printf("first\n"); } return 0;} 阅读全文
posted @ 2013-06-10 16:47 Ac_国士无双 阅读(98) 评论(0) 推荐(0)
hdu5209,hdu1907
摘要:博弈,简单题,两道只能算作一道 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int a,i,t,n,m[100],a1,j,count; 6 while(scanf("%d",&n)!=EOF) 7 { 8 memset(m,0,sizeof(m)); 9 count=0;10 for(i=0;i<n;i++)11 {12 scanf("%d",&a);13 if(a>1) count... 阅读全文
posted @ 2013-06-10 16:33 Ac_国士无双 阅读(168) 评论(0) 推荐(0)