Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • 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
Programmingoneonone

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

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes