| ||||||||||
| 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<iostream>
#include<cstdio>
using namespace std;
int main()
{
int n;
int a,b;
scanf("%d",&n);int c=0;
while(n--){
++c;
scanf("%d%d",&a,&b);
int left=0,right=0;
while(a!=1 || b!=1){
if(a>b){
int temp=a/b;
if(a%b==0)temp--;
left+=temp;
a-=temp*b;
}
else {
int temp=b/a;
if(a%b==0)temp--;
right+=temp;
b-=a*temp;
}
}
printf("Scenario #%d:\n%d %d\n\n",c,left,right);
//cout<<""<<c<<':'<<endl;
//cout<<left<<' '<<right<<endl<<endl;
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator