标签:
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 9033 | Accepted: 3695 |
Description
25 7
11 7
4 7
4 3
1 3
1 0
Input
Output
Sample Input
34 12 15 24 0 0
Sample Output
Stan wins Ollie wins
Source
1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 #include<algorithm> 5 #define LL long long 6 int main(){ 7 int tmp,n,m,pl; 8 while(scanf("%d %d",&n,&m)!=EOF&&(n&&m)){ 9 pl=0; 10 while(n&&m){ 11 if(m<n){tmp=m;m=n;n=tmp;} 12 if((n<<1)>0&&m>=(n<<1))break; 13 m=m%n; 14 if(!m)break; 15 pl^=1; 16 } 17 if(!pl)puts("Stan wins"); 18 else puts("Ollie wins"); 19 } 20 return 0; 21 }
[poj2348]Euclid's Game(博弈论+gcd)
标签:
原文地址:http://www.cnblogs.com/Pumbit-Legion/p/5962614.html