2013年6月11日
摘要: 题意要求除了对输赢的判断,还有对第一次取法的计数。所以先要对状态做判断,至于取法则是要看每堆扑克牌与异或结果最高位对应的位上是否为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_国士无双 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题不难,看题意的时候把自己坑了,还以为是威佐夫博奕,其实直接求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_国士无双 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 巴什博奕,简单题 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_国士无双 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 求两段区间中最大公约数为k的数字的对数,下界除以k后就会变成,求区间中与n互质的数字的对数。主要错在了两个地方,k=0和b,d大小的判断。 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 阅读全文
posted @ 2013-06-11 14:38 Ac_国士无双 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 容斥原理,求会被去掉的数字的个数,在ai组成的集合中用最小公倍数作为除数。 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 <cstdio>10 #include <st 阅读全文
posted @ 2013-06-11 14:28 Ac_国士无双 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 区间找素数,求差。(if( len <=1) 这里把<漏了,Runtime error,原因:ans是空的。 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 <cstdi 阅读全文
posted @ 2013-06-11 09:32 Ac_国士无双 阅读(181) 评论(0) 推荐(0) 编辑