20 lines
484 B
C++
20 lines
484 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
double k;
|
|
double x = 2.0; // x代表上一步走的距离
|
|
double s = 2.0; //已经走过的距离是2
|
|
int n = 1; //表示已经走完第1步
|
|
int main() {
|
|
cin >> k; //要走多远
|
|
while (true) {
|
|
n++;
|
|
x *= 0.98; //每次是在上一步距离上 * 0.98
|
|
s += x; //累加距离
|
|
if (s >= k) { //达标
|
|
cout << n << endl;
|
|
break;
|
|
}
|
|
}
|
|
}
|