LοgεnΓos_707 @ 2023-03-23 22:54:53
k = int(input())
lst = [1]
for i in range(0, len(lst)):
n = int(len(lst))
if sum(lst) <= k:
lst = lst.append(1.0 / (n + 1.0))
else:
print(n)
by pengyuanxi @ 2023-05-02 16:25:33
#include<bits/stdc++.h>
using namespace std;
int k,n;
double s;
int main()
{
cin>>k;
while(k>=s)
{
n++;
s=s+1.0/n;
}
cout<<n;
return 0;
}
by lirunxiao @ 2023-07-26 21:52:35
@pengyuanxi 6,人家是Python你给他个c++