Problems
10036 - Who is The First?
SUBMIT PROBLEM

Who is The First?

Time Limit: 2 sec

 

The Problem

Sefo is a student of CSE (Computer Science & Engineering) at CUET (Chittagong University of Engineering & Technology). Recently, their 2nd semester result has been published. But the result only consists of the GPA of all subjects of each student, not the full result. He wants to calculate the CGPA (GPA of that semester) of every student so that he can know if he is the First or not.

They have total 5 subjects. Each subject has some Credit. To calculate one’s CGPA, the sum of every subject’s GPA multiplies the Credit of that subject, is divided by the sum of the credit.

For example, if the credit of 5 subjects are 3, 3, 3, 1.5, 1.5 and a student’s GPA in that subjects are respectively 4, 3.5, 3.5, 2, 2 . Then his CGPA will be equal to,

(3*4+3*3+3*3.5+1.5*2+.75*2)/(3+3+3+1.5+.75) = 3.2 .

If Sefo’s CGPA is greater than the CGPA of other students than he has got the First place, Else he has not got the first place.

 

The Input

The first line of the input consists of the number of test case t (1 < t ≤ 500). The next line will contain 5 numbers a1 – a5 (.75 ≤ ai ≤ 3) . The number ai denotes the credit of the ith subject. The next t line will contain some test case. In every case the first line will be the number of student n in Sefo’s class. The next line will contain the GPA of Sefo in every subject. The next n-1 line will contain the GPA (2 ≤ GPA ≤4) of every student in every subject.

 

The Output

For each test case print the case number as “Case #i: ”. Then, If Sefo is the First then print Yahoo! Else printOops!”. For more information see the sample output.

 

Sample Input

2

3 3 3 1.5 .75

5

3.5 2 2 4 4

3 2.5 2.5 3.5 3.5

4 4 3 3 2

3.25 3.25 3 3 3

4 3.75 4 3.5 3.5

3

4 4 4 4 4

3.5 3.5 3.25 4 4

3 3.25 4 4 3.5

 

Sample Output

Case #1: Oops!

Case #2: Yahoo!

 

 

 

[College Level]

1st Online Programming Contest 2016 by Outsbook

Problem Setter: Fahim Abrar