Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贪心了,上代码

Posted by jufusong at 2013-03-04 16:30:19 on Problem 2348
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator