Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

Codechef Test Score problem solution

YASH PAL, 31 July 2024

In this Codechef Test Score problem solution In a test, there are NN problems, each carrying XX marks.

In each problem, Chef either received XX marks or 00 marks.

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

Codechef Test Score problem solution

Problem solution in Python.

for i in range (int(input())):
    n,x,y=map(int,input().split())
    if ((n*x)-y)%x==0:
        print("yes")
    else:
        print("no")

Problem 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();
		for(int i = 0;i< T; i++){
		    int N = sc.nextInt();
		    int X = sc.nextInt();
		    int Y = sc.nextInt();
		    
		        if( Y % X == 0){
		            System.out.println("yes");
		        }else{
		            System.out.println("NO");
		        }
		       
		    
		     
		}
	}
}

Problem solution in C++.

#include <iostream>
using namespace std;

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

Problem solution in C.

#include <stdio.h>

int main(void) {
	// your code goes here
	int t,n,x,y;
	scanf("%d",&t);
	while(t--)
	{
	    scanf("%d%d%d",&n,&x,&y);
	    if(y%x!=0)
	    printf("non");
	    else
	      {
	          if(y/x<=n)
	          printf("yesn");
	          else
	          printf("non");
	      }
	}
	return 0;
}
Codechef Solutions coding problems

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes