Test Score CodeChef Solution

Problem – Test Score CodeChef Solution

In a test, there are N problems, each carrying X marks.
In each problem, Chef either received X marks or 0 marks.

Determine whether is it possible for Chef to achieve exactly Y marks.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of three integers N,X, and Y, the number of problems, the maximum score for each problem, and the score Chef wants.

Output Format

For each test case, output YES if Chef can achieve exactly Y marks, NO otherwise.

You can print each character of the string in uppercase or lowercase. For example, the strings , yes, and yEs, are all considered identical.

Constraints

  • 1≤T≤100
  • 1≤N≤10
  • 1≤X≤10
  • 0≤YNX

Sample 1:

Input: 
5
1 8 4
3 6 12
4 5 0
10 10 100
8 5 36
Output: 
NO
YES
YES
YES
NO

Explanation:

Test case 1: There is no way for Chef to score exactly 4 marks.

Test case 2: Chef can score 12 marks by receiving 6 marks in 2 problems and 0 marks in 1 problem.

Test case 3: Chef can score 0 marks by receiving 0 marks in each of the 4 problems.

Test case 4: Chef can score 100 marks by receiving 10 marks in each of the 10 problems.

Test case 5: There is no way for Chef to score exactly 36 marks.

Test Score CodeChef Solution in Python3

# cook your dish here
t=int(input())
for i in range(t):
    A,B,C=list(map(int,input().split()))
    if C%B==0:
        print("YES")
    else:
        print("NO")

Test Score CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    int n,x,y;
	    cin>>n>>x>>y;
	    if(y%x==0){
	        cout<<"YES\n";
	    }
	    else{
	        cout<<"NO\n";
	    }
	}
	return 0;
}

Test Score 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 sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0){
		int n=sc.nextInt();
		int x=sc.nextInt();
		int y=sc.nextInt();
		if(y%x==0 ||y==0)
		System.out.println("YES");
		else
		System.out.println("NO");
		}
	}
}
Test Score CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Test Score 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 *