李元朔 @ 2019-03-12 21:24:01
#include<iostream>
using namespace std;
int main()
{
int k;
cin>>k;
float sn=0,n=1;
while(sn<=k)
{
sn=sn+1.0/n;
if(sn<=k)
n++;
}
cout<<n<<endl;
return 0;
}
by 基地A_I @ 2019-03-12 21:26:39
@李元朔 开 double 就行,精度太小
by 基地A_I @ 2019-03-12 21:26:54
float精度太小