| ||||||||||
| 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 | |||||||||
贴出来给大家看看#include<stdio.h>
void main()
{
double a;
int i,n;
while(1)
{
scanf("%lf",&a);
if(a==0)
break;
for(n=1;;n++)
{
double sum=0;
for(i=1;i<=n;i++)
sum+=1.0/(i+1);
if(sum>=a)
break;
}
printf("%d card(s)\n",n);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator