jiangyunrui @ 2024-10-27 17:48:29
救救窝
#include<iostream>
using namespace std;
int main()
{
int n,i,s;
cin>>n;
for(i=1;i<=n;i++)
{
s+=i;
if(s>5)break;
}
cout<<i;
return 0;
}
by _luogu_huowenshuo_ @ 2024-10-27 18:14:15
@jiangyunrui
#include<bits/stdc++.h>
using namespace std;
int main()
{
int k,n=0;
double sn;
cin >> k;
for(double sn=0;sn<=k;++n,sn+=1.0/n)
{
}
cout << n;
return 0;
}
by wusongxu @ 2024-10-27 18:23:06
@jiangyunrui
下次发帖时请阅读提问的智慧
具体的描述你的问题。
(这道题是你的模拟出了问题)
#include<iostream>
using namespace std;
int main()
{
int i;
int n;
double s = 0;
cin>>n;
for(i = 1; s <= 1.0 * n; i ++){
s += 1.0 / i;
}
i--;
cout<<i;
return 0;
}
by jiangyunrui @ 2024-10-27 19:58:29
@_luoguhuowenshuo @wusongxu灰常感谢好吧
by jiangyunrui @ 2024-10-27 19:59:10
@wusongxu 谢谢 ????