Mizuiro79 @ 2021-01-31 19:06:05
#include<iostream>
using namespace std;
int main()
{
int k,n=1;
double sum=0.000000;
cin>>k;
while(sum<=k)
{
n++;
sum+=(1.0/n);
}
cout<<n-1<<endl;
return 0;
}
by 小小小朋友 @ 2021-01-31 19:31:37
@江澂子、堯 n++;
和sum+=(1.0/n);
的顺序不能反了