IcaRuS @ 2016-10-18 20:47:12
#include<stdio.h>
int main()
{
float s;
int n,k;
scanf("%d",&k);
for(n=1,s=0;;n++)
{
s=s+1.0/n;
if(s>k)
{
printf("%d",n);break;
}
}
return 0;
}
by IcaRuS @ 2016-10-20 23:51:25
搞定了,double赋值给float时会错误
by hermitttt @ 2016-11-23 19:05:08
和楼主出现了一样的问题,求解