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 Exceed请教为什么我的程序会Time Limit Exceed。这种简单运算怎么会超过1秒的运行时间,在本机上是很快的。做测试时,有什么注意事项吗? 万分感谢! 代码如下: #include <stdio.h> int main () { int i; int np,ne,ni,nd; i=0; while (1) { scanf("%d %d %d %d", &np, &ne, &ni, &nd); if ( (np==-1) || (ne==-1) || (ni==-1) || (nd==-1) ) break; while (1) { np += 23; if (np>21252) np -= 21252; if ( (np>ne) && (np>ni) && ((np-ne)%28 == 0) && ((np-ni)%33 == 0) ) break; } printf("Case %d: the next triple peak occurs in %d days.\n\n", i+1, np-nd ); i++; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator