w3180756048 @ 2022-01-15 18:17:04
理论上这题其实不难,但是要注意很多细节,比如1.0/n,和sn要用double.我看了半天都没反应过来。以下是代码。
int main()
{
int k,n=1;
double sum = 0.0;
scanf("%d", &k);
for (n = 1;;n++)
{
sum = sum + 1.0 / n;
if (sum > k)
{
printf("%d", n);
break;
}
}
return 0;
}
by MatrixGroup @ 2022-01-15 18:28:13
阅
by ssytxy2024 @ 2022-01-15 18:39:45
CCCCCCCCCCCCCCCCOrz
by lsj2009 @ 2022-01-15 18:40:20
tlqtj %%%
by lsj2009 @ 2022-01-15 18:40:44
jbl
by zhanchengwen @ 2022-05-05 16:46:49
我就是这么AC的