| ||||||||||
| 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 | |||||||||
为什么结果是Wrong Answer 呢?请大家帮忙看看#include<stdio.h>
main()
{
float a[10],sum=0.0,n;
int i=0,c;
do
{
scanf("%f",&a[i]);\*这里我省去了判断是否在0.01~5.20之间,应该不是这里错吧*\
}while(a[i++]!=0.0);
for(i=0;a[i]!=0;i++)
{ sum=0.0;
n=2;
c=0;
if(a[i]<=0.5)c=1;
else
{
do
{
sum=sum+1/n;
n=n+1;
c=c+1;
}while(sum<a[i]);
}
printf("%d card(s)\n",c);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator