CGPHY005-Editorial

PROBLEM LINK:

Practice
Contest-CODEOGRAPGHY 2.0

Author: Rachit Bhatia
Tester: Rachit Bhatia
Editorialist: Rachit Bhatia

DIFFICULTY:

CAKEWALK

PREREQUISITES:

None

PROBLEM:

You are asked to check if R runs per over are enough for India to chase the given target.

QUICK EXPLANATION:

Just check if 15*R>=(0.8)*(X+Z-Y)

EXPLANATION:

Original target to be chased is (X+Z-Y)
After it starts to rain target is reduced to (0.8)*(X+Z-Y)
India will score 15*R runs in 15 overs.
Now just check if 15*R>=(0.8)*(X+Z-Y), if true then India will be able to chase else not.

SOLUTIONS:

Editorialist's Solution
#include <bits/stdc++.h>

using namespace std;

#define ll long long int

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t;

    cin >> t;

    while (t--)

    {

        int x, y, z, r;

        cin >> x >> y >> z >> r;

        int target = x + z - y;

        double t = 0.8 * target;

        if (15 * r >= t)

            cout << 1 << endl;

        else

            cout << 0 << endl;

    }

    return 0;

}