标签:des style blog color java os io strong for
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2074 Accepted Submission(s): 924
1 #include<iostream> 2 #include<string> 3 #include<cstdio> 4 #include<vector> 5 #include<queue> 6 #include<stack> 7 #include<algorithm> 8 #include<cstring> 9 #include<stdlib.h> 10 using namespace std; 11 int p[101000],cnt; 12 int main(){ 13 int n,m; 14 while(cin>>n>>m,n+m){ 15 if(n>m) swap(n,m); 16 if(m%n==0){ 17 cout<<"Stan wins"<<endl;continue; 18 } 19 cnt=0; 20 while(m%n!=0){ 21 p[cnt++]=m/n; 22 m-=m/n*n; 23 if(n>m) swap(n,m); 24 } 25 int can=0,ps=-1; 26 for(int i=0;i<cnt;i++) 27 if(p[i]>1){ 28 ps=i;break; 29 } 30 if(ps==-1) { 31 if(cnt%2) cout<<"Ollie wins"<<endl; 32 else cout<<"Stan wins"<<endl; 33 } 34 else{ 35 if(ps%2) cout<<"Ollie wins"<<endl; //第二个首先掌握主动权 36 else cout<<"Stan wins"<<endl; 37 } 38 } 39 }
标签:des style blog color java os io strong for
原文地址:http://www.cnblogs.com/ainixu1314/p/3931892.html