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:谁能帮我改一下,把正确的贴出来,是C的。谢谢!

Posted by Grandet at 2007-03-07 20:14:57 on Problem 1003
In Reply To:谁能帮我改一下,把正确的贴出来,是C的。谢谢! Posted by:boss185 at 2006-12-20 14:38:27
可以的啊
这道题其实直接这样精度就可以了
> #include <stdio.h>
> #include <math.h>
> 
> int main()
> {
>    float c,sum,n;
>    
>    scanf ("%f",&c);
> 
>    while (fabs(c) < 0.001) { 
>       for (sum = 0,n = 1;sum < c;n++)
>          sum += 1 / (n + 1);
>       printf ("%d card(s)\n",(int)n-1);
>       scanf ("%f",&c);
>    }
> 
>    return 0;
> }

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