Miracle_InDream @ 2023-08-08 22:45:00
#include<bits/stdc++.h>
using namespace std;
int main()
{
int k;
int n;
cin>>k;
float ans=1;
for(int i=1;ans<=k;i++)
{
ans+=1.0/i;
if(ans>k)
n=i+1;
}
cout<<n;
return 0;
}
by Night_sea_64 @ 2023-08-08 22:50:14
@david0911 不对吧
by Night_sea_64 @ 2023-08-08 22:50:53
@liyirong567 首先你
by Night_sea_64 @ 2023-08-08 22:51:34
然后 n=i
by david0911 @ 2023-08-08 22:54:37
抱歉看错了,紫衫
by Miracle_InDream @ 2023-08-09 06:57:54
60分了,#3#5WA
by mazx_lhy @ 2023-08-10 08:10:57
要用double,float的精度不够
by Zzy66 @ 2023-08-13 19:32:19
n不应该=i吗为什么是i+1