Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:怎么会Time Limit Exceeded!高人指教啊。小弟菜,想了许久依然茫然……

Posted by lorryboy at 2008-09-09 19:16:23 on Problem 1003
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++)吧

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator