Advertisement
Josif_tepe

Untitled

Dec 3rd, 2021
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int p = 0;
  8.     int denovi = 0;
  9.     int h, u, d;
  10.     cin >> h >> u >> d;
  11.     while (p < h)
  12.     {
  13.         denovi++;
  14.         p += u;
  15.         if (p >= h)
  16.         {
  17.             cout << denovi << endl;
  18.             break;
  19.         }
  20.         p -= d;
  21.     }
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement