PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: notsoloud
Testers: iceknight1093, rivalq
Editorialist: iceknight1093
DIFFICULTY:
455
PREREQUISITES:
None
PROBLEM:
A friend group of three is perfect if one of them has an age equal to the sum of the other two.
Given the ages of a friend group, check whether it is perfect.
EXPLANATION:
It is enough to simply implement what is asked for directly: check whether any one of A, B, or C are equal to the sum of the other two.
This can be implemented with three if
conditions.
A solution with slightly less casework is to check whether A+B+C equals 2\cdot\max(A, B, C), which is an equivalent condition.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Code (Python)
for _ in range(int(input())):
a, b, c = map(int, input().split())
print('Yes' if a + b + c == 2*max(a, b, c) else 'No')