雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年4月10日

摘要: 先找必败态如:一堆石头有8个NO:0 1 2 3 4 5 6 7 8S :P N N N P N N N P即s=a%(b+1)if s==0 就为必败态在用nim博弈是s^(a%(b+1))即可View Code #include<stdio.h>int main(){ int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); int i,a,b,s; for(i=1;i<=n;i++) { scanf("%d%d",&a,& 阅读全文

posted @ 2011-04-10 21:21 huhuuu 阅读(312) 评论(0) 推荐(0) 编辑

摘要: 如将50倍化为二进制110010对应32 16 8 4 2 1就是50是由32+16+2组成(加法)而推广到乘法里2^50=(2^32)*(2^16)*(2^2)=2^(32+16+2)View Code #include<stdio.h>int main(){ int n,m,k; scanf("%d%d%d",&n,&m,&k); int i,add=0,t,j; for(i=1;i<=n;i++) { __int64 all,rall=1; scanf("%d",&t); all=t; int co 阅读全文

posted @ 2011-04-10 10:28 huhuuu 阅读(236) 评论(0) 推荐(0) 编辑

摘要: 1*2+2*3+3*4+……+n*(n+1)=n*(n+1)*(n+2)/3注意数据大了,所以先n*(n+1)取% (20090524*3)保证后面的数可以被3除View Code #include<stdio.h>int t;int main(){ scanf("%d",&t); while(t--) { __int64 n; scanf("%I64d",&n); __int64 all=0; if(n==1) { printf("1\n"); continue; } all=(__int64)(n*(n 阅读全文

posted @ 2011-04-10 09:29 huhuuu 阅读(172) 评论(0) 推荐(0) 编辑