Chef and Lockout Draws CodeChef Solution

Problem – Chef and Lockout Draws CodeChef Solution

Bob and Alice are having a lockout match between them. There are three problems in the contest worth AB, and C points respectively. Only the first player to solve a problem gets points for that problem. It is impossible for Bob and Alice to solve a problem at the same time. Chef wants to know if there is any chance of a draw if Bob and Alice manage to solve all 3 problems. A draw occurs when both players end with equal number of points.

Input Format

  • First line will contain T, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, three space separated integers AB, and C.

Output Format

For each testcase, output YES if the match can end in a draw, and NO otherwise.

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≤1000
  • 1≤A,B,C≤10^6

Subtasks

Subtask #1 (100 points): original constraints

Sample 1:

Input:
3
2 5 2
4 2 2
3 5 5
Output:
NO
YES
NO

Explanation:

In the first and third test cases, it is impossible for Bob and Alice to solve the problems so that they have the same number of points at the end.

In the second case, it is possible for Bob to solve the first problem, and Alice to solve the last two problems, in which case they will both have 4 points and the game will end in a draw.

Chef and Lockout Draws CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;cin>>t;
	while(t--){
	    int a,b,c;
	    cin>>a>>b>>c;
	    if(a+b==c||b+c==a||a+c==b) cout<<"YES"<<endl;
	    else cout<<"NO"<<endl;
	}
	return 0;
}

Chef and Lockout Draws CodeChef Solution in Pyth 3

# cook your dish here
for i in range(int(input())):
    a,b,c=map(int,input().split())
    if b+c == a or a+b == c or a+c == b:
        print("YES")
    else:
        print("NO")

Chef and Lockout Draws 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 in=new  Scanner(System.in);
		int te=in.nextInt();
		while(te-->0){
		    int a=in.nextInt();
		    int b=in.nextInt();
		    int c=in.nextInt();
		    if(a+b==c || b+c==a || a+c==b)
		    System.out.println("YES");
		    else
		    System.out.println("NO");
		}
	}
}
Chef and Lockout Draws CodeChef Solution Review:

In our experience, we suggest you solve this Chef and Lockout Draws 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 Chef and Lockout Draws CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Chef and Lockout Draws 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 *