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

a>=2*b要用long long,亲们!因为2*b可能超过int的范围,附AC代码

Posted by sanyaocangku at 2012-08-28 22:30:38 on Problem 2348 and last updated at 2012-08-28 22:43:34
#include <stdio.h>
int main()
{
	int a,b,t;
	while(scanf("%d%d",&a,&b)!=EOF)
	{
		if(a+b==0)break;
		if(a<b)
			a=a^b,b=a^b,a=a^b;
		t=0;
		while(a%b!=0)
		{
			if(a/b>=2)break;
			a=a-b;
			if(a<b)
			a=a^b,b=a^b,a=a^b;
			t=!t;
		}
		if(!t)
			printf("Stan wins\n");
		else
			printf("Ollie wins\n");
	}
	return 0;
}

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