Car Choice Solution || Codechef Starters - 28

         

Car Choice Solution 

Codechef Starters - 28
Problem Code : CARCHOICE

Solution :

#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;

void solve()
{
    long double x1, x2, y1, y2;
    cin >> x1 >> x2 >> y1 >> y2;
    long double a, b;
    a = y1 / x1;
    b = y2 / x2;

    if (a < b)
    {
        cout << "-1\n";
    }
    else if (a > b)
    {
        cout << "1\n";
    }
    else
    {
        cout << "0\n";
    }
}

int main()
{
    ll t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}

Comments