Divide Students Into Classes solution codechef
You are given the heights ofstudents who want to attend a school. The school, being weird as usual, has a condition that all the students in a class should have the same height. Also, the school runs only 12 classes from class 1 to class 12.
Find out whether it is possible for you to divide all thestudents into 12 classes. Note that in each class, there should be at least one student, and the heights of all the students should be equal. Multiple classes can have students with the same height also.
Input Divide Students Into Classes solution codechef
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains an integer .
- The second line contains space-separated integers denoting the heights of the students.
Output Divide Students Into Classes solution codechef
For each test case, print a single line containing “yes” or “no” (without quotes) depending on the situation.
- For 40% of the score:
- Remaining 60%: No extra constraints.
- Alphabet Difference solution codechef
- Queries in an Array solution codechef
3 3 1 2 3 12 1 2 3 4 5 6 7 8 9 10 11 12 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Sample Output Divide Students Into Classes solution codechef
no yes yes
Example case 1: There are only three students. So there is no way that there can be at least one student in each class.
Example case 2: There are only twelve students. Each student can go into a separate class.
Example case 3: There are total fourteen students. One way of dividing them into classes will be class 1 to 10, one student each. While 11th and 12th class have two each.