Euclid's Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1166 Accepted Submission(s): 537
25 7
11 7
4 7
4 3
1 3
1 0
an Stan wins.
34 12 15 24 0 0
Stan wins Ollie wins
============================
思路:http://www.cnblogs.com/kuangbin/archive/2013/05/04/3059871.html
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int a,b;
while(~scanf("%d%d",&a,&b))
{
if(a==0&&b==0)
break;
bool flag=true;
while(1)
{
if(a<b)
{
a^=b;b^=a;a^=b;
}
if(a/b>=2||a==b)
break;
a-=b;
flag=!flag;
}
if(flag)
{
cout<<"Stan wins"<<endl;
}
else
{
cout<<"Ollie wins"<<endl;
}
}
return 0;
}
426




被折叠的 条评论
为什么被折叠?



