Chef and Cook-Off Codechef Solution

Hello Programmers In this post, you will know how to solve the Chef and Cook-Off Codechef Solution.

Chef and Cook-Off Codechef Solution
Chef and Cook-Off Codechef Solution

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Codechef by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Problem

Chef has obtained the results of a past Cook-Off. He wants to estimate the skill level of each contestant. The contestants can be classified with high probability (w.h.p.) based on the number of solved problems:

  • A contestant that solved exactly 0 problems is a beginner.
  • A contestant that solved exactly 1 problem is a junior developer.
  • A contestant that solved exactly 2 problems is a middle developer.
  • A contestant that solved exactly 3 problems is a senior developer.
  • A contestant that solved exactly 4 problems is a hacker.
  • A contestant that solved all five problems is Jeff Dean.

Please help Chef to identify the programming level of each participant.

Input

  • The first line of the input contains a single integer N denoting the number of competitors.
  • N lines follow. The i-th of these lines contains five space-separated integers Ai, 1, Ai, 2, Ai, 3, Ai, 4, Ai, 5. The j-th of these integers (1 ≤ j ≤ 5) is 1 if the i-th contestant solved the j-th problem and 0 otherwise.

Output

For each participant, print a single line containing one string denoting Chef’s classification of that contestant — one of the strings “Beginner”, “Junior Developer”, “Middle Developer”, “Senior Developer”, “Hacker”, “Jeff Dean” (without quotes).

Constraints

  • 1 ≤ N ≤ 5000
  • 0 ≤ Ai, j ≤ 1 for each valid ij

Sample Input 1 

7
0 0 0 0 0
0 1 0 1 0
0 0 1 0 0
1 1 1 1 1
0 1 1 1 0
0 1 1 1 1
1 1 1 1 0

Sample Output 1 

Beginner
Middle Developer
Junior Developer
Jeff Dean
Senior Developer
Hacker
Hacker

Explanation

The first contestant has no solved problems, therefore he is a beginner. The second contestant solved 2 problems (the second and fourth problem), therefore he has the skills of a middle developer. The third contestant solved 1 problem, therefore he’s at the expected level of a junior developer. The fourth contestant solved 5 problems — we can guess it was Jeff Dean. The fifth contestant solved 3 problems, so he is a senior developer. And the last two contestants should be hackers because they solved exactly 4 problems each.

Ezoicreport this adChef and Cook-Off 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
	{
		// your code goes here
		Scanner x=new Scanner(System.in);
		int t=x.nextInt();
		int i;
		while(t-- >0)
		{
		    int arr[]=new int[5000];
		    int count=0;
		    for(i=0;i<5;i++)
		    {
		        if(x.nextInt()==1)
		        {
		            count=count+1;
		        }
		    }
		    if(count==0)
		    {
		        System.out.println("Beginner");
		    }
		    else if(count==1)
		    {
		        System.out.println("Junior Developer");
		    }
		    else if(count==2)
		    {
		        System.out.println("Middle Developer");
		    }
		    else if(count==3)
		    {
		        System.out.println("Senior Developer");
		    }
		    else if(count==4)
		    {
		        System.out.println("Hacker");
		    }
		    else if(count==5)
		    {
		        System.out.println("Jeff Dean");
		    }
		}
	}
}
Ezoicreport this ad

Chef and Cook-Off CodeChef Solution in CPP

#include <iostream>
using namespace std;
int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    int arr[5];
	    int c=0;
	    for(int i=0;i<5;i++){
	        cin>>arr[i];
	        if(arr[i]==1){
	            c++;
	        }
	    }
	    if(c==5){
	        cout<<"Jeff Dean"<<endl;
	    }
	    else if(c==4){
	        cout<<"Hacker"<<endl;
	    }
	    else if(c==3){
	        cout<<"Senior Developer"<<endl;
	    }
	    else if(c==2){
	        cout<<"Middle Developer"<<endl;
	    }
	    else if(c==1){
	        cout<<"Junior Developer"<<endl;
	    }
	    else{
	        cout<<"Beginner"<<endl;
	    }
	}
	return 0;
}

Chef and Cook-Off CodeChef Solution in Python

t = int(input())
d = {0:'Beginner',1:"Junior Developer",2:"Middle Developer",3:"Senior Developer",4:"Hacker",5: "Jeff Dean"}
for i in range(t):
    l = list(map(int,input().split()))
    print(d[l.count(1)])

Disclaimer: The above Problem (Chef and Cook-Off) is generated by CodeChef but the solution is provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.

Note:- I compile all programs, if there is any case program is not working and showing an error please let me know in the comment section. If you are using adblocker, please disable adblocker because some functions of the site may not work correctly.

Next: Buying Sweets Codechef Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad