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