fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int N, M, K;
  6. cin >> N >> M >> K;
  7. if (N = 0) {
  8. return 0;
  9. }
  10. int x;
  11.  
  12. if (N % 2 <= M) {
  13. x = N; // aktywacja pod warunkiem
  14. }
  15.  
  16.  
  17.  
  18.  
  19.  
  20. for (int i = 0; i < K; i++) {
  21. N -= x;
  22. M -= x / 2;
  23. M += x;
  24. }
  25.  
  26. cout << M << endl;
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0.01s 5320KB
stdin
0 0 10
stdout
0