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 |
why wrong#include <stdio.h> int main(void) { long int x,y,m,n,l,cha,count,dis,i; scanf("%ld%ld%ld%ld%ld",&x,&y,&m,&n,&l); cha=m-n; dis=y-x; if(cha==0) printf("Impossible\n"); else{ if(dis>0&&cha<0){ dis=l-dis; cha=-cha; } else if(dis<0&&cha>0) dis=l+dis; else if(dis<0&&cha<0){ dis=-dis; cha=-cha; } for(i=0;;i++){ count=(dis+i*l)/cha; if(count*cha==dis+i*l) break; } printf("%d\n",count); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator