| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
贪心了,上代码#include<iostream>
using namespace std;
int num;
void gcd(int a,int b)
{
if(b==0)
{
num--;
return ;
}
if(a/b>=2) //只要碰到倍数超过2则必胜
return ;
num++;
gcd(b,a%b);
}
int main()
{
int a,b;
while(cin>>a>>b,a||b)
{
num=0;
gcd(max(a,b),min(a,b));
if(num%2==0)
cout<<"Stan wins"<<endl;
else
cout<<"Ollie wins"<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator