Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int p, t, x, m;
- float e;
- cin >> p >> t >> x;
- e = p * 0.436;
- m = 0;
- int taupykleje;
- for (int i = 0; i < x; i++) {
- int likePinigai = p - e;
- if (likePinigai >= t) {
- taupykleje = t;
- likePinigai -= t;
- } else {
- int pinigaiIkiMax;
- pinigaiIkiMax = taupykleje - t;
- if (likePinigai < pinigaiIkiMax) {
- likePinigai = 0;
- taupykleje += likePinigai;
- } else {
- likePinigai -= pinigaiIkiMax;
- taupykleje = t;
- }
- }
- if (taupykleje == t) {
- taupykleje = 0;
- m++;
- }
- }
- cout << fixed << setprecision(2) << e << endl;
- cout << m << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement