Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Football Cup CodeChef Solution

Problem – Football Cup CodeChef Solution

It is the final day of La Liga. Chef has a certain criteria for assessing football matches.
In particular, he only likes a match if:

  • The match ends in a draw, and,
  • At least one goal has been scored by either team.

Given the goals scored by both the teams as X and Y respectively, determine whether Chef will like the match or not.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases. The description of T test cases follows.
  • Each test case consists of a single line of input containing two space-separated integers X and Y — the goals scored by each team.

Output Format

For each test case, output YES if Chef will like the match, else output NO.

You may print each character of the string in uppercase or lowercase (for example, the strings YeS, yEs, yes and YES will all be treated as identical).

Constraints

  • 1≤T≤100
  • 0≤X,Y≤9

Sample 1:

Input: 4
1 1
0 1
0 0
2 2

Output: YES
NO
NO
YES

Explanation:

Test case 1: It is a draw in which both teams have scored a goal, Chef will like this match.

Test case 2: The game is not a draw. Hence, Chef will not like this match.

Test case 3: Neither team scored a goal, so Chef will not like this match.

Test case 4: It is a draw in which both teams scored 2 goals each. Chef will like this match.

Football Cup CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    int x, y;
	    cin>>x>>y;
	    if(x==y && x>0){
	        cout<<"Yes"<<endl;
	    }
	    else{
	        cout<<"No"<<endl;
	    }
	}
	return 0;
}

Football Cup CodeChef Solution in Pyth 3

n=int(input())
for i in range(n):
    a,b=list(map(int,input().split()))
    if a>0 and b>0:
        if a==b:
            print("Yes")
        else:
            print("NO")
    else:
        print("NO")

Football Cup CodeChef Solution in Java

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

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		for(int i=0;i<n;i++){
		    int a=in.nextInt();
		    int b=in.nextInt();
		    if(a==b && a!=0 && b!=0){
		        System.out.println("YES");
		    }
		    else{
		        System.out.println("NO");
		    }
		}
	}
}
Football Cup CodeChef Solution Review:

In our experience, we suggest you solve this Football Cup 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 Football Cup CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Football Cup 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 *