swsy2345b @ 2024-12-01 13:44:05
#include<bits/stdc++.h>
using namespace std;
double q=0;
int main()
{
double n;
cin>>n;
for(double i=1;true;i++)
{
q=q+1/i;
if(q>=n)
{
cout<<i;
return 0;
}
}
}//有问题吗???
by quxiangyu @ 2024-12-01 14:01:00
求关注QWQ
#include<bits/stdc++.h>
using namespace std;
int main()
int k;
int sum = 0;
{
cin >> k;
for(double i = 0 ; i <= k; ++sum , i += 1.0 / sum);
cout<< sum;
return 0;
}
by swsy2345b @ 2024-12-02 20:59:49
已关注