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

哎 过了. 怀疑有的测试数据的节点不能从(1,1) 推出来!

Posted by ook at 2005-07-24 00:23:13 on Problem 2499
In Reply To:为什么是RE???? Posted by:ook at 2005-07-23 23:57:21
> #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