652A - Gabriel and Caterpillar - CodeForces Solution


implementation math *1400

Please click on ads to support us..

C++ Code:

#include <iostream>

using namespace std;

int main() {
    int apple_height, track_height;
    cin >> track_height >> apple_height;

    int a, b;
    cin >> a >> b;

    apple_height -= track_height + 8 * a;
    a = (a - b) * 12;

    int days_to_wait = 0;
    if (apple_height <= 0) {
        days_to_wait = 0;
    }
    else if (a <= 0) {
        days_to_wait = -1;
    }
    else {
        days_to_wait = (apple_height + a - 1) / a;
    }

    cout << days_to_wait;

    return 0;
}


Comments

Submit
0 Comments
More Questions

1088B - Ehab and subtraction
1270B - Interesting Subarray
478C - Table Decorations
1304C - Air Conditioner
1311C - Perform the Combo
1519C - Berland Regional
361A - Levko and Table
5E - Bindian Signalizing
687A - NP-Hard Problem
1542C - Strange Function
961E - Tufurama
129D - String
888A - Local Extrema
722B - Verse Pattern
278A - Circle Line
940A - Points on the line
1742C - Stripes
1742F - Smaller
1742B - Increasing
1742A - Sum
1742D - Coprime
390A - Inna and Alarm Clock
1398B - Substring Removal Game
1742G - Orray
416B - Art Union
962A - Equator
803B - Distances to Zero
291A - Spyke Talks
1742E - Scuza
1506D - Epic Transformation