8 条题解
- 1
信息
- ID
- 79
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 2
- 标签
- 递交数
- 149
- 已通过
- 92
- 上传者
#include <iostream>
using namespace std;
int main()
{
int n, x = 1;
float a = 0;
cin >> n;
while (a <= n)
{
a = a + 1.0 / x;
x += 1;
}
cout << x - 1;
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
int i=0,x;
cin>>x;
double sum=0;
while(sum<=x){
i++;
sum=sum+1.0/i;
}
cout<<i;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int x;
int n=1;
double sum;
int main(){
cin>>x;
while (true){
sum+=(double)1/n;
if (sum>x){
cout<<n;
return 0;
}
n++;
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
double x,m,sum;
int main()
{
cin>>x;
m=1;
while(sum<=x)
{
sum+=1/m;
m++;
}
cout<<m-1;
return 0;
}
#include <iostream> using namespace std; int main() { int n; cin >> n; double s = 0; int i; for (i = 1;; i++) { s += 1.0 / i; if (s > n) { break; } } cout << i; return 0; }