摘要:
如果n/m>1的话就Stan wins否则就球gcd,看经过多少次可以出现m==0的情况。注意的是在求gcd的过程中会出现n/m>1的情况,#include"iostream"using namespace std;int gcd(int n,int m){ int i=0; while(1) { if(n/m>1) break; i++; n-=m; if(n<m) {int tmp=m;m=n;n=tmp;} if(m==0) break; } return i;}int main(){ int n,m; while(cin>>n&g 阅读全文
摘要:
简单的NIM游戏过程,就不分析了。#include"iostream"using namespace std;int main(){ int n; while(cin>>n) { int i,k,ans=0; for(i=0;i<n;i++) { cin>>k; ans^=k; } if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0;} 阅读全文
摘要:
Alice and Bob decide to play a new stone game.At the beginning of the game they pick n(1<=n<=10) piles of stones in a line. Alice and Bob move the stones in turn.At each step of the game,the player choose a pile,remove at least one stones,then freely move stones from this pile to any other pil 阅读全文