CCOOK - Editorial

Problem Link:

Practice

Contest

Setter: Misha Chorniy

Tester: Ke Bi

Editorialist: Rashad Mammadov


Difficulty:

CAKEWALK

Prerequisites:

Loops, Conditional statements

Problem:

You are given the results of each contestant for 5 problems, either 1 or 0 - which means the contestant has solved it or not correspondingly, and wants you to find his/her level(“Beginner”, “Junior Developer”, “Middle Developer”,“Senior Developer”,“Hacker”, or Jeff Dean).

Explanation:

It is just a straight-forward problem. The solution is to sum the results for each row and output the corresponding skill given in the problem statement using " if " conditions. Preferably you may use " switch - case " to make your code seem elegant. :slight_smile:

Time Complexity:

O(N)

Space Complexity:

O(N) or O(1)

2 Likes
Preferably you may use " switch - case " to make your code seem elegant. :)

And probably forget break statement after some case and get WA :stuck_out_tongue: .

But honestly though, I used switch case cause, HELL YEAH! Elegant! :smiley: However, the constant fear of missing break statement or getting compile time error was dreading over me XD. We dont get many questions where we can elegantly apply switch case instead of if else checking for equality.

1 Like

Neither if-else nor switch-case :slight_smile:
https://www.codechef.com/viewsolution/17470455

3 Likes