mester/K1/2bankbetet.cpp
2021-11-02 09:12:43 +01:00

24 lines
449 B
C++

#include <iostream>
using namespace std;
int main() {
int x, s, p, h, y = 0;
cin >> x >> s >> p >> h;
for (int i = 0; i < h; ++i) {
if (x >= 1000) {
x += (s + p) * (x / 100);
}
else {
x += s * (x / 100);
}
y += x % 100;
x -= x % 100;
if (y / 100 >= 1) {
y -= 100;
x += 100;
}
cout << x << " " << y << endl;
}
}