hzx01 @ 2024-08-27 13:06:10
#include<bits/stdc++.h>
using namespace std;
int main(){
int k, n = 1;
cin >> k;
float tot = 0;
for(float i = 1.0; tot <= k; i++, n++){
tot += 1.0 / i;
}
cout << n-1;
return 0;
}
by cai_cai_cai @ 2024-08-27 13:13:28
#include<bits/stdc++.h>
using namespace std;
int main(){
int k, n = 1;
cin >> k;
long double tot = 0;
for(long double i = 1.0; tot <= k; i++, n++){
tot += 1.0 / i;
}
cout << n-1;
return 0;
}
by Vuglar_zuo @ 2024-08-27 13:13:32
float改成long double
by Ghosty_Neutrino @ 2024-08-27 13:13:33
@hzx01
把float 改成 double
by cai_cai_cai @ 2024-08-27 13:13:49
6
by Vuglar_zuo @ 2024-08-27 13:13:53
7
by Vuglar_zuo @ 2024-08-28 08:34:15
不是。找人帮忙后怎么就人间蒸发了?不好吧!
by cgxd @ 2024-09-08 15:24:29
这题k很小,打表就能过