Qualify the round CodeChef Solution

Problem – Qualify the round CodeChef Solution

In a coding contest, there are two types of problems:

  • Easy problems, which are worth 1 point each
  • Hard problems, which are worth 2 points each

To qualify for the next round, a contestant must score at least X points. Chef solved A Easy problems and B Hard problems. Will Chef qualify or not?

Input Format

  • The first line of input contains 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 three space-separated integers — X,A, and B.

Output Format

For each test case, output a new line containing the answer — Qualify if Chef qualifies for the next round, and NotQualify otherwise.

Each character of the answer may be printed in either uppercase or lowercase. For example, if the answer is Qualify, outputs such as qualifyquALiFyQUALIFY and QuAlIfY will also be accepted as correct.

Constraints

  • 1≤T≤100
  • 1≤X≤100
  • 0≤A,B≤100

Sample 1:

Input: 3
15 9 3
5 3 0
6 2 8
Output: Qualify
NotQualify
Qualify

Explanation:

Test Case 1: Chef solved 9 easy problems and 3 hard problems, making his total score 9⋅1+3⋅2=15. He needs at least 15 points to qualify, which he has and hence he qualifies.

Test Case 2: Chef solved 3 easy problems and 0 hard problems, making his total score 3⋅1+0⋅2=3. He needs at least 5 points to qualify, which he doesn’t have and hence doesn’t qualify.

Test Case 3: Chef solved 2 easy problems and 8 hard problems, making his total score 2⋅1+8⋅2=18. He needs at least 6 points to qualify, which he has and hence he qualifies.

Qualify the round CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
    int t;
    cin>>t;
    while(t--) {
        int x, a, b ;
        cin>>x>>a>>b;
        if( a + 2*b >= x) {
            cout<<"Qualify\n";
        }
        else {
            cout<<"NotQualify\n";
        }
    }
	return 0;
}

Qualify the round CodeChef Solution in Pyth 3

t = int(input())

for _ in range(t):
    x, a, b = map(int, input().split())
    score = a + b*2
    if score >= x:
        print('Qualify')
    else:
        print('NotQualify')

Qualify the round 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
	{
		Scanner sc=new Scanner(System.in);
		int T=sc.nextInt();
		for(int i=0;i<T;i++)
		{
		  int x=sc.nextInt();
		  int y=sc.nextInt();
		  int z=sc.nextInt();
		  int a=y+z*2;
		  if(a>=x)
		  System.out.println("Qualify");
		  else
		  System.out.println("NotQualify");
		}
	}
}
Qualify the round CodeChef Solution Review:

In our experience, we suggest you solve this Qualify the round 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 Qualify the round CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Qualify the round 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.