| ||||||||||
| 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>
int main()
{
float b,sum=0;
int n,a[1000],i=0;
n=2;
for(i=0;i<1000;i++)
a[i]=0;
i=0;
while(scanf("%f",&b)!=EOF&&b!=0.00)
{
if(b<=0.2)
{
a[i]=1;
i++;
}
else{
while(sum<b)
{
sum+=(1.00/n);
n++;
}
a[i]=n-2;
i++;
}
}
for(i=0;i<1000;i++)
{
if(a[i]!=0)
printf("%d card(s)\n",a[i]);
else break;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator