CSP_AK_xyy20110721 @ 2022-03-28 12:41:17
#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 Keep_RAD @ 2022-03-28 12:50:26
你 在 干 什 么
by TBClikeZT @ 2022-03-28 12:52:27
@xyy20110721 您自己看一下,不多做解释了qaq
#include<bits/stdc++.h>
using namespace std;
int main(){
int n=1,k;
double s=0;
cin>>k;
while(s<=k)
{
s+=(1.0/(double)(n));
n++;
}
cout<<--n;
return 0;
}
by TBClikeZT @ 2022-03-28 12:52:56
@run_after_dream ?
by Keep_RAD @ 2022-03-28 12:54:35
@TBC_LJ 有问题吗,我不知道他在写什么
by TBClikeZT @ 2022-03-28 13:04:24
@run_after_dream 没问题啊,我也看不懂
by luqyou @ 2022-03-28 13:06:18
@xyy20110721 你在干啥看得懂题目吗(doge)
by CSP_AK_xyy20110721 @ 2022-03-28 21:15:04
@luqyou卢泓希 不太懂,我按我编程书上的程序打的
by IloveHuTao @ 2022-04-03 18:29:39
有毒?通分不香吗?先通分再弄
by UildStudio @ 2022-04-29 11:32:08
你在干啥,我看不懂
by nikodo @ 2022-05-03 17:32:34
#include<iostream>
using namespace std;
int main(){
int c,k,n;
long double b;
cin>>k;
for(b=0,n=1;true;b=b+1.0/n,n++){
if(b>k) break;
}
cout<<n-1;
return 0;
}
**挨个加就行了