
1. The remaining oxygen level should only be accepted if it is in the range between [1, 100] both inclusive else the oxygen level will be marked as 0.
2. If the calculated maximum average oxygen remaining value of trainees is below 70, then declare the trainees as unfit with the meaningful message as “Unfit.”
3. The average remaining Oxygen level should be rounded.
Output for the above case will be
Trainee1
Unfit
Trainee3
Because the maximum average is 70 which is in the range and Trainee 1 and 3 both have the same value.
Trainee 2 is unfit because the average is below 70.
The first line of input contains an integer 'T' which denotes the number of test cases to be run. Then the test cases follow.
The next 3 lines of each test case contain 3 space-separated integers denoting the oxygen level of each trainee after each round.
For each test case, print the fittest trainee. If more than one trainee has the same highest average oxygen level then print all of them in increasing order.
Print “Unfit” if the average oxygen level is less than 70.
Print the output of each test case in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the given function.
1 <= ‘T’ <= 100
1 <= ‘OXYGEN[i][j]’ <= 100
Where ‘OXYGEN[i][j]’ denotes the oxygen level of 'ith' candidate after 'jth' round.
Time Limit: 1 sec
The idea behind this approach is to calculate the average of all the rounds and store them in an array/list and then calculate the maximum of all the average remaining oxygen levels. If more than one have the same value then print the trainee number and if average is less than 70 then simply print “Unfit”.
Here is the complete algorithm: