HITACorz @ 2019-08-06 14:20:37
int main(void)
{
int k,i;
float n,num=0.0;
scanf("%d",&k);
n=1;
i=0;
for(i=0;num<=k;i++)
{
num+=(1/n);
n++;
}
printf("%d",i);
return 0;
}
by turTLE_Null @ 2019-08-06 14:22:31
1/n 改成 1.0/n 试试
by 反手一只MJJ @ 2019-08-06 14:25:49
@JryACtrying
int /*k,*/i;
float n,num=0.0,k;
/*scanf("%d",&k);*/
scanf("%f",&k)
n=1;
i=0;
by 反手一只MJJ @ 2019-08-06 14:26:56
@JryACtrying
awa
by HITACorz @ 2019-08-06 14:34:46
@turTLE_Null 前几次调试的时候这么改过了,还是只过了同样的三个点
by HITACorz @ 2019-08-06 14:40:19
@反手一只MJJ 还是不对 ,还是只过了原来的三个点
by turTLE_Null @ 2019-08-06 21:21:23
flaot -> double
试试
by turTLE_Null @ 2019-08-06 21:21:27
@JryACtrying
by lds112 @ 2019-08-08 21:27:34
改成double吧,用float的时候好像3,5过不了
by HITACorz @ 2019-08-10 08:16:47
@turTLE_Null 改了以后就全对了,谢谢你!!!!!!
by HITACorz @ 2019-08-10 08:17:07
@lds112 感谢指点,AC了