Chef and Cook-Off CodeChef Solution

Problem – Chef and Cook-Off CodeChef Solution

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 1:

Input:
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
Output:
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.

Chef and Cook-Off CodeChef 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();
		 while(t-- >0)
		 {
		     int count = 0;
		     int arr[] = new int[5];
		     for(int i = 0 ; i < 5 ; i++)
		      arr[i] = sc.nextInt();
		  
		    for(int i =0 ; i < 5 ; i++)
		    {
		        if(arr[i] == 1)
		        count++;
		    }
		     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");
		 }
	}
}

Chef and Cook-Off CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int n;
	cin>>n;
	
	for (int i=0; i<n; i++){
	    
	    int a, sum = 0;
	    
	    for (int j=0; j<5; j++){
	        cin>>a;
	        sum += a;
	    }
	    
	    if(sum == 0) cout<<"Beginner"<<endl;
	    else if(sum == 1) cout<<"Junior Developer"<<endl;
	    else if(sum == 2) cout<<"Middle Developer"<<endl;
	    else if(sum == 3) cout<<"Senior Developer"<<endl;
	    else if(sum == 4) cout<<"Hacker"<<endl;
	    else cout<<"Jeff Dean"<<endl;
	    
	}
	
	return 0;
}

Chef and Cook-Off CodeChef Solution in Pyth 3

# cook your dish here
for i in range(int(input())):
    a = list(map(int,input().strip().split()))[:5]
    if a.count(1)==0:
        print("Beginner")
    elif a.count(1)==1:
        print("Junior Developer")
    elif a.count(1)==2:
        print("Middle Developer")
    elif a.count(1)==3:
        print("Senior Developer")
    elif a.count(1)==4:
        print("Hacker")
    else:
        print("Jeff Dean")
Chef and Cook-Off CodeChef Solution Review:

In our experience, we suggest you solve this Chef and Cook-Off 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 Chef and Cook-Off CodeChef Solution

Find on CodeChef

Conclusion:

I hope this Chef and Cook-Off 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. Required fields are marked *