http://acm.hdu.edu.cn/showproblem.php?pid=1527
交换 :可实现。
1 if( n < m ) 2 19 { 3 20 n^=m; 4 21 m^=n; 5 22 n^=m; 6 23 }
(三)尼姆博奕(Nimm
Game):有三堆各若干个物品,两个人轮流从某一堆取任意多的
物品,规定每次至少取一个,多者不限,最后取光者得胜。的应用。
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3018 Accepted Submission(s): 1498
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int b,t,k,n,a; 6 while(~scanf("%d%d",&a,&b)) 7 { 8 if(a<b) 9 { 10 t=a; 11 a=b; 12 b=t; 13 } 14 k=a-b; 15 n=(int)k*(1+sqrt(5))/2.0; 16 if(n==b) 17 printf("0\n"); 18 else 19 printf("1\n"); 20 } 21 return 0; 22 }
原文:http://www.cnblogs.com/cancangood/p/3513789.html