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 |
time limit?#include <stdio.h> #include <math.h> void main(){ int m,n,x,y,l,i; scanf("%d %d %d %d %d",&x,&y,&m,&n,&l); if(m!=n){ for(i=1;;i++){ if(((x+m*i)-(y+n*i))%l==0) break; } printf("%d\n",i); } 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