Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int height, a, b;
- int sum = 0, run = 0;
- cin >> height >> a >> b;
- while (sum < height)
- {
- sum = sum + a;
- if (sum >= height)
- {
- run++;
- break;
- }
- sum = sum - b;
- run++;
- }
- cout << run;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment