PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Tester & Editorialist: iceknight1093
DIFFICULTY:
541
PREREQUISITES:
None
PROBLEM:
Chef has three water bottles, and will fill them up if at least two are empty.
Given the state of the three bottles B_1, B_2, B_3 (each being either 0 or 1 denoting full/empty), decide whether Chef will fill them up.
EXPLANATION:
Check whether at least two of the bottles are empty.
This can be done using casework (check each pair of bottles); or simply check whether B_1+B_2+B_3 \leq 1.
After this check, print the answer appropriately.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
b1, b2, b3 = map(int, input().split())
print('Water filling time' if b1+b2+b3 <= 1 else 'Not now')