Lily95 @ 2022-08-05 16:04:35
#include<iostream>
int main()
{
using namespace std;
int k;
cin>>k;
int n=1;
double sum=1;
while(k>=sum)
{
n++;
sum=sum+1/n;
}
cout<<n;
return 0;
}
by Hisaishi_Kanade @ 2022-08-05 16:06:09
1/n
1.0/n
int
类型整除是下取整
by Lily95 @ 2022-08-07 18:54:41
@bye_wjx 懂了,感谢!