Algorithm
problem Link : https://www.codechef.com/LTIME111D/problems/TESTAVG
Problem
Chef has scored and marks in different subjects respectively.
Chef will fail if the average score of any two subjects is less than . Determine whether Chef will pass or fail.
Input Format
- First line will contain , number of test cases. Then the test cases follow.
- Each test case contains of a single line of input, three integers , denoting the Chef's score in the three subjects.
Output Format
For each test case, if Chef will pass, print PASS, otherwise print FAIL.
You may print each character of the string in uppercase or lowercase (for example, the strings pass, Pass, pAss, and PASS will all be treated as identical).
Constraints
Sample 1:
4 23 47 52 28 36 80 0 100 0 35 35 35
Pass Fail Fail Pass
Explanation:
Test case : The average of the first two subjects is , the average of the first and last subject is , whereas the average of the last two subjects is . Since all averages are greater than or equal to , Chef will pass.
Test case : Since the average of the first two subjects is which is less than , Chef will fail.
Test case : Since the average of the first and last subjects subjects is which is less than , Chef will fail.
Test case : Since the average of any two subjects is which is greater than or equal to , Chef will pass.
Code Examples
AdvertisementsDemonstration
CodeChef solution TESTAVG - Test Averages CodeChef solution in Codechef solution in C,C++