PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: still_me
Testers: the_hyp0cr1t3, rivalq
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
You are given three integers A, B, C. Find an integer between 1 and 100 that doesn’t divide any of them.
EXPLANATION:
There are several different ways to solve this problem.
One simple way is to simply iterate every number from 1 to 100 and check whether it satisfies the condition; that is, use 3 if
statements to check divisibility with each of A, B, C.
As soon as you find an integer that satisfies the condition, print it and break out of the loop.
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Code (Python)
for _ in range(int(input())):
a, b, c = map(int, input().split())
for p in [67, 71, 97, 87]:
if p == a or p == b or p == c: continue
print(p)
break