Course Registration CodeChef Solution

Problem – Course Registration CodeChef Solution

There is a group of N friends who wish to enroll in a course together. The course has a maximum capacity of M students that can register for it. If there are K other students who have already enrolled in the course, determine if it will still be possible for all the N friends to do so or not.

Input Format

  • The first line contains a single integer T – the number of test cases. Then the test cases follow.
  • Each test case consists of a single line containing three integers NM and K – the size of the friend group, the capacity of the course and the number of students already registered for the course.

Output Format

For each test case, output Yes if it will be possible for all the N friends to register for the course. Otherwise output No.

You may print each character of Yes and No in uppercase or lowercase (for example, yesyEsYES will be considered identical).

Constraints

  • 1≤T≤1000
  • 1≤NM≤100
  • 0≤KM

Sample 1:

Input: 3
2 50 27
5 40 38
100 100 0
Output: Yes
No
Yes

Explanation:

Test Case 1: The 2 friends can enroll in the course as it has enough seats to accommodate them and the 27 other students at the same time.

Test Case 2: The course does not have enough seats to accommodate the 5 friends and the 38 other students at the same time.

Course Registration CodeChef Solution in C++17

#include<bits/stdc++.h>
using namespace std;
#define int long long int 
int32_t main(){
    int t;
    cin>>t;
    while(t--)
    {
        int n,m,k;
        cin>>n>>m>>k;
        m-=k;
        if(n<=m)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}

Course Registration CodeChef Solution in Pyth 3

for i in range(int(input())):
    N,M,K = map(int,input().split())
    if (abs(M-K) >= N):
        print("Yes")
    else:
        print("No")

Course Registration CodeChef Solution in Java

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
			Scanner scn= new Scanner(System.in);    //System.in is a standard input stream  
        int T= scn.nextInt();
        
       for(int i=0; i<T; i++){
        int N= scn.nextInt();
        int M= scn.nextInt();
        int K= scn.nextInt();
       
        if((M-K)>=N){
        
        System.out.println("YES");
        }
        else{
            System.out.println("NO");
        }
       }
	}
}
Course Registration CodeChef Solution Review:

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

Find on CodeChef

Conclusion:

I hope this Course Registration 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.