Eletronic_Monkey @ 2024-10-14 21:42:29
#include<stdio.h>
int main()
{
int k;
int n=0;
float sum=0;
scanf("%d",&k);
while(sum<=k)
{
n++;
sum+=1.0/n;
}
printf("%d",n);
return 0;
}
by CZY880201 @ 2024-10-14 21:48:34
double
by CZY880201 @ 2024-10-14 21:48:57
double sum=0;
by CZY880201 @ 2024-10-14 21:49:27
https://www.luogu.com.cn/record/182168554
by Eletronic_Monkey @ 2024-10-14 21:55:42
@CZY880201 ok,可以了 谢谢
by ex24013216 @ 2024-10-15 23:43:16
@CZY880201 为什么要用double,用float不行
by CZY880201 @ 2024-10-17 12:50:37
思考一下1/0.3,如何使精度误差最小