Skip to content
Programmingoneonone
Programmingoneonone

Learn everything about programming

  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
    • Cybersecurity
  • 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
Programmingoneonone
Programmingoneonone

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 solutions

Post navigation

Previous post
Next post

Are you a student and stuck with your career or worried about real-time things, and don't know how to manage your learning phase? Which profession to choose? and how to learn new things according to your goal, and land a dream job. Then this might help to you.

Hi My name is YASH PAL, founder of this Blog and a Senior Software engineer with 5+ years of Industry experience. I personally helped 40+ students to make a clear goal in their professional lives. Just book a one-on-one personal call with me for 30 minutes for 300 Rupees. Ask all your doubts and questions related to your career to set a clear roadmap for your professional life.

Book session - https://wa.me/qr/JQ2LAS7AASE2M1

Pages

  • About US
  • Contact US
  • Privacy Policy

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes