PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: Abhinav Gupta
Testers: Nishank Suresh, Tejas Pandey
Editorialist: Nishank Suresh
DIFFICULTY:
500
PREREQUISITES:
None
PROBLEM:
Given A, B, and C, determine whether the average of A and B is strictly greater than C.
EXPLANATION:
The average of A and B is \frac{A+B}{2}. Compute this value and check whether it is greater than C using an if
condition.
Make sure to compute \frac{A+B}{2} using floats, since the standard /
division in most languages is integer (floor) division. You should use something like (A+B)/2.0
instead of (A+B)/2
.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
a, b, c = map(int, input().split())
print('yes' if a+b > 2*c else 'no')