Question Name:LITTLE JHOOL & HIS PUNISHMENT

#include <stdio.h>
 
int main(){
	long t,n,b,g;
    scanf("%ld",&t);
    while(t--){
        scanf("%ld%ld%ld",&n,&b,&g);
        if(b==g || abs(b-g)==1)
        printf("The teacher wins!\n");
        else
        printf("Little Jhool wins!\n");
    }
}

Problem Description

Little Jhool was was the most intelligent kid of his school. But he did NOT like his class teacher, his school, and the way he was taught things in school. Well, he was a rebel, to say the least. Like most of us, he hated being punished by his teacher – specially, when the punishment was to sit beside someone of the opposite gender. (Oh, he was a kid, come on!)

There are n number of students in the class, b being the number of boys, and g being the number of girls. Little Jhool decided to challenge his class teacher when she started punishing the entire class using the aforesaid mentioned punishment – making them sit in a straight line outside the class, beside someone of the opposite gender.

The challenge is as follows: Little Jhool selects a student from the class and make him or her sit outside the class. Then, his teacher picks another student from the remaining students, and makes him or her sit next in the line. Little Jhool and teacher then take alternate turns, until all the students of the class are seated.

If the number of pairs of neighboring students of the same gender is GREATER than the number of pairs of neighboring students of the opposite gender, output “Little Jhool wins!” , otherwise, “The teacher wins!”

Input format:

The first line contains, tc, the number of test cases. Following that, the next line contains n, the total number of students in the class. Then, in the next line, there are two integers, b and g representing the number of boys and girls in the class, respectively.

Output format:

You have to print “Little Jhool wins!” or “The teacher wins!” according to the condition.

Constraints:
1 <= t <= 50
1 <= n, b, g <= 100

PS: -> n = b + g
-> There will always be at least one boy and one girl in the class.

  • Test Case 1

    Input (stdin)

    2
    4
    3 1
    3
    2 1
    

    Expected Output

    Little Jhool wins!
    The teacher wins!
  • Test Case 2

    Input (stdin)

    3
    38
    4 34
    90
    67 23
    54
    25 29
    

    Expected Output

    Little Jhool wins!
    Little Jhool wins!
    Little Jhool wins!

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro