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() { unsigned long int x,y,m,n,L; unsigned long int sum1,sum2; unsigned int flag=0,i; scanf("%d%d%d%d%d",&x,&y,&m,&n,&L); for(sum1=x,sum2=y,i=1;i<L;i++) { sum1+=m; sum2+=n; sum1%=L; sum2%=L; if(sum1==sum2) { flag=1; break; } } if(flag) 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