Header Ad

HackerEarth Aldrin Justice problem solution

In this HackerEarth Aldrin Justice problem solution Lily Aldrin, as the slap bet commissioner, needs to resolve issues regarding slap bets due with Barney and Marshall. She has mandated that there be a fixed period of time in which the slaps may be used.

So, she draws two lines representing the given two-time slots, each of Barney and Marshall; you need to help her write a program that:

Outputs "Nothing" if given lines are indistinguishable.
Outputs "Line" if there exists a timeline(more than one day) in which none of them have the opportunity to slap.
Outputs "Point" if the intersection of lines is just in one point.


HackerEarth Aldrin Justice problem solution


HackerEarth Aldrin Justice problem solution.

#include <bits/stdc++.h>

using namespace std;

int main ()
{
int tc;
cin >> tc;
while (tc--)
{
int a, b, c, d;
cin >> a >> b >> c >> d;

int lef = min(max(a, b), max(c, d));
int righ = max(min(a, b), min(c, d));

if (lef>righ)
{
cout << "Nothing" << endl;
}

else
{
if (lef==righ)
{
cout << "Point" << endl;
}
else
{
cout << "Line" << endl;
}
}
}
return 0;
}

Post a Comment

0 Comments