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

为什么是RE????

Posted by ook at 2005-07-23 23:57:21 on Problem 2499
#include "stdio.h"

long long  a,r,l,b;
void sun()
{
	if(a>b&&b!=1)
	{
		l+=a/b;
	    a=a-b*(a/b);
		sun();
	}
	else 
		if(a<b&&a!=0)
		{
			r+=b/a;
			b=b-a*(b/a);
			sun();
		}
		else
			if(a==1&&b!=1)
			{
				r+=b-1;
				b=1;
				sun();
			}
			else
				if(b==1&&a!=1)
				{
					l+=a-1;
					a=1;
					sun();
				}
				else
					if(a==1&&b==1)
						return;
}

int main()
{
	long long  i,n;
	scanf("%ld",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%ld%ld",&a,&b);
		r=l=0;
		sun();
          printf("Scenario #%ld:\n",i);
	 printf("%ld %ld\n\n",l,r);	
	}
    return 1;
}

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