Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Is the Score Consistent CodeChef Solution

Problem – Is the Score Consistent CodeChef Solution

Chef is watching a football match. The current score is A:BA:B, that is, team 11 has scored AA goals and team 22 has scored BB goals. Chef wonders if it is possible for the score to become C:DC:D at a later point in the game (i.e. team 11 has scored CC goals and team 22 has scored DD goals). Can you help Chef by answering his question?

Input Format

  • The first line contains a single integer TT – the number of test cases. Then the test cases follow.
  • The first line of each test case contains two integers AA and BB – the intial number of goals team 11 and team 22 have scored respectively.
  • The second line of each test case contains two integers CC and DD – the final number of goals team 11 and team 22 must be able to score respectively.

Output Format

For each testcase, output POSSIBLE if it is possible for the score to become C:DC:D at a later point in the game, IMPOSSIBLE otherwise.

You may print each character of POSSIBLE and IMPOSSIBLE in uppercase or lowercase (for example, possiblepOSsiBLePossible will be considered identical).

Constraints

  • 1≤T≤1000
  • 0≤A,B,C,D≤10

Sample 1:

Input: 3
1 5
3 5
3 4
2 6
2 2
2 2
Output: POSSIBLE
IMPOSSIBLE
POSSIBLE

Explanation:

Test case 1: The current score is 1:5. If team 1 scores 2 more goals, the score will become 3:5. Thus 3:5 is a possible score.

Test case 2: The current score is 3:4. It can be proven that no non-negative pair of integers (x,y) exists such that if team 1 scores x more goals and team 2 scores y more goals the score becomes 2:6 from 3:4. Thus in this case 2:6 is an impossible score.

Test case 3: The current score is already 2:2. Hence it is a possible score.

Is the Score Consistent CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	int t;
	cin >> t;
	while(t--){
	    int a,b,c,d;
	    cin >> a >> b >> c >> d;
	    if( a <= c && b <= d){
	        cout << "Possible" << endl;
	    }
	    
	    else{
	        cout << "Impossible" << endl;
	    }
	}
	return 0;
}

Is the Score Consistent CodeChef Solution in Pyth 3

# cook your dish here
t = int(input())
for i in range(t):
    a,b = map(int,input().split(" "))
    c,d = map(int,input().split(" "))
    if c<a:
        print("IMPOSSIBLE")
    elif d<b:
        print("IMPOSSIBLE")
    else:
        print("POSSIBLE")

Is the Score Consistent CodeChef Solution in Java

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner s = new Scanner(System.in);
		int t = s.nextInt();
		while(t-->0)
		{
		    int a = s.nextInt();
		    int b = s.nextInt();
		    int c = s.nextInt();
		    int d = s.nextInt();
		    if(c>=a && d>=b)
		    System.out.println("Possible");
		    else 
		    System.out.println("Impossible");
		    
		}
	}
}
Is the Score Consistent CodeChef Solution Review:

In our experience, we suggest you solve this Is the Score Consistent CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Is the Score Consistent CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Is the Score Consistent CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions

Leave a Reply

Your email address will not be published. Required fields are marked *