scientific_comp_projects/CODE/[python]kattis/trivial/number_fun.py
2021-10-29 15:16:40 +02:00

35 lines
577 B
Python

test_cases = int(input())
p = 'Possible'
n = 'Impossible'
r = []
for i in range(test_cases):
numbers = input()
a,b,c = numbers.split(' ')
a = int(a)
b = int(b)
c = int(c)
if a + b == c:
r.append(p)
elif abs(a-b) == c:
r.append(p)
elif a*b == c:
r.append(p)
elif a%b ==0:
if a//b == c:
r.append(p)
else:
r.append(n)
elif b%a ==0:
if b//a == c:
r.append(p)
else:
r.append(n)
else :
r.append(n)
for i in r:
print(i)