fangjiacheng @ 2019-11-13 12:19:56
#include<bits/stdc++.h>
#include<cstdio>
int main()
{
double s=0.000,n=0.000,k=0.000;
scanf("%lf",&k);
for( n=1.0;s<=k;n+=1.0)
{
s+=1.0/n;
}
n--;
printf("%lf",n);
return 0;
}
帮我
by Inkyo @ 2019-11-13 12:31:36
麻烦你过了样例再来求助好吧
by Inkyo @ 2019-11-13 12:31:50
输一下样例你马上就能知道哪里错了
by fangjiacheng @ 2019-11-13 13:49:31
输入1就会输出2.000000??????????????????????????????????????
by yyqyjya @ 2019-11-13 18:18:02
输出要格式化呀,可以用%.0lf吧。我觉得。