| ||||||||||
| 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 | |||||||||
Re:为什么总是 wrong Answer! 各位大侠帮帮我!快疯了,这也错了!In Reply To:为什么总是 wrong Answer! 各位大侠帮帮我!快疯了,这也错了! Posted by:cao0303 at 2006-08-08 09:06:48 > #include <stdio.h>
> #define zero 0.000001
> main()
> {
> float leng;
> float temp;
> int i;
> while(leng!=0)
> {
> scanf("%f",&leng);
> temp=0;
> for(i=1;i<32767;i++)
> { if((temp-leng)>zero)
> {printf("%d card(s)\n",i-1);
> break;}
> temp=temp+1.00/(float)(i+1);
> }
> }
> return 0;
> }
//change it to this
#include <stdio.h>
#define zero 0.00//00000001
main()
{
float leng=1;
float temp;
int i;
scanf("%f",&leng);
while(leng!=0)
{
temp=0;
for(i=1;i<32767;i++)
{ if((temp-leng)>=zero)
{printf("%d card(s)\n",i-1);
break;}
temp=temp+1.00/(float)(i+1);
}
scanf("%f",&leng);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator