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 |
Re:怎么会Time Limit Exceeded!高人指教啊。小弟菜,想了许久依然茫然……In Reply To:怎么会Time Limit Exceeded!高人指教啊。小弟菜,想了许久依然茫然…… Posted by:crg511 at 2008-04-28 10:05:57 > #include <stdio.h> > void main() > { > int j; > float a,i,sum; > scanf("%.2f",&a); > while(a!=0.00) > { sum=0.00; > for(i=2.00;(sum+=1/i)>a;i++); > j=i; > printf("%d card(s)\n",j); > scanf("%.2f",&a); > } > } > for(i=2.00;(sum+=1/i)>a;i++);//这句有问题吧!是一个死循环(sum+=1/i)的值只有1 or 0; Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator