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