| ||||||||||
| 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 | |||||||||
那位大虾告诉我这个为什么是错的?小妹在这里先谢了#include "stdio.h"
void main()
{
unsigned long f,t,x,y,m,n,l,b=1;
int c=1;
scanf("%ld%ld%ld%ld%ld",&x,&y,&m,&n,&l);
f=x+m*b;t=y+n*b;
if(x==y) printf("%s","Impossible");
else{
do{ if(f==t)
{printf("%ld",b); break;}
else {
if(f>=l)
do{f=f-l;
}while(f>l);
if(t>=l)
do{t=t-l;
}while(t>l);
b++;
f=f+m;
t=t+n;
}
if(f>=l)
do{f=f-l;
}while(f>l);
if(t>=l)
do{t=t-l;
}while(t>l);
if(f==x&&t==y)
{printf("%s","Impossible");
break;}
}while(c);}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator