| ||||||||||
| 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()
{
long int x,y,m,n,L;
scanf("%ld%ld%ld%ld%ld",&x,&y,&m,&n,&L);
if(m>n)
{
if((x-y>0)&&(L+y-x)%(m-n)==0)
printf("%ld\n",(L+y-x)/(m-n));
else
if(x-y<0&&(y-x)%(m-n)==0)
printf("%ld\n",(y-x)/(m-n));
else
printf("Impossible\n");
}
else
if(m<n)
{
if(x-y>0&&(x-y)%(n-m)==0)
printf("%ld\n",(x-y)/(n-m));
else
if((x-y)<0&&(L+x-y)%(n-m)==0)
printf("%ld\n",(L+x-y)/(n-m));
else
printf("Impossible\n");
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator