zhangbochen @ 2023-11-01 12:36:52
WA求教<_<
#include<bits/stdc++.h>
using namespace std;
int main(){
double k,n=1,sn;
cin>>k;
while(1){
sn+=1/n;
if(sn>k)
break;
n++;
}
cout<<n;
return 0;
}
by Starry_dream @ 2023-11-01 12:55:00
条件改一下
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n=0,k;
cin>>k;
double sum=0;
while(sum<=k)
{
n++;
sum+=(double)1/n;
}
cout<<n;
return 0;
}
记得关注哦!
by zhangbochen @ 2023-11-01 13:28:24
酸Q为瑞玛曲