AcWing 3444. 买房子
原题链接
简单
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y;
int f[N];
bool flag;
void solve() {
while (cin >> n >> k) {
double m = 0, p = 200, i = 1;
flag = false;
for (; i <= 21; i++) {
m += n;
if (m >= p) {
flag = true;
break;
}
p *= (1 + k / 100.0);
}
if (flag) {
cout << i;
} else {
cout << "Impossible";
}
cout << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}