zhonghongye @ 2023-07-12 21:26:19
#include<bits/stdc++.h>
using namespace std;
int main()
{
double k=1,s=0;
int n,i;
cin>>n;
for(i=1;;i++)
{
s+=1.0/k;
if(s>n)
break;
}
cout<<i;
return 0;
}
by wwqwq @ 2023-07-12 21:35:06
@zhonghongye
给你改了一下
#include<bits/stdc++.h>
using namespace std;
int main()
{
double s=0;
int n,i;
cin>>n;
for(i=1;;i++)
{
s+=1.0/i;
if(s>n)
break;
}
cout<<i;
return 0;
}
by wwqwq @ 2023-07-12 21:35:33
这个k定义的没用啊,要除的是i
by wwqwq @ 2023-07-12 21:38:38
如果有帮助给个关注谢谢喵
by zhonghongye @ 2023-07-26 20:00:05
OK啊!谢谢