| ||||||||||
| 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 | |||||||||
慢慢来~~In Reply To:谁能帮我改一下,把正确的贴出来,是C的。谢谢! Posted by:boss185 at 2006-12-20 14:38:27 #include <stdio.h>
#include <math.h>
int main()
{
double c,sum,n;
scanf ("%lf",&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 ("%lf",&c);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator