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 |
Help~~~Why WA#include<stdio.h> int x,y,m,n,l; int v,s,p; int main() { scanf("%d%d%d%d%d",&x,&y,&m,&n,&l); if((m-n)%l==0) { printf("Impossible\n"); return 0; } v=(m-n+l+l)%l; s=(x-y+l+l)%l; s=l-s; p=s%v; while(1) { if(s%v==0) { printf("%d\n",s/v); break; } s+=l; if(s%v==p||s/v>l) { printf("Impossible\n"); break; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator