PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: notsoloud
Testers: iceknight1093, rivalq
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
Alice, Bob, and Charlie have A, B, C rupees respectively.
A Netflix subscription costs X rupees.
Is it possible for exactly two of them to purchase a subscription?
EXPLANATION:
There are three possible sums of two people: A+B, A+C, B+C.
If any of these three is \geq X, the answer is “Yes”. Otherwise, the answer is “No”.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
a, b, c, x = map(int, input().split())
print('Yes' if max(a+b, a+c, b+c) >= x else 'No')