| ||||||||||
| 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 | |||||||||
为什么是RE????#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator