-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathPython3DPrinting.py
More file actions
38 lines (31 loc) · 962 Bytes
/
Python3DPrinting.py
File metadata and controls
38 lines (31 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def find_color(test_cases, printers):
results = []
for t in range(test_cases):
min_units = 0
my_colors = [0, 0, 0, 0]
for i in range(4):
min_units = min(printers[t][0][i], printers[t][1][i], printers[t][2][i])
my_colors[i] = min_units
if sum(my_colors) < 10**6:
my_colors[i] = min_units
elif sum(my_colors) >= 10**6:
a = sum(my_colors) - 10**6
my_colors[i] = my_colors[i] - a
break
if sum(my_colors) < 10**6:
results.append(["IMPOSSIBLE"])
else:
results.append(my_colors)
return results
def main():
test_cases = int(input().strip())
printers = []
for _ in range(test_cases):
printer_info = [list(map(int, input().split())) for _ in range(3)]
printers.append(printer_info)
results = find_color(test_cases, printers)
for i, result in enumerate(results):
print(f"Case #{i+1}: ", end='')
print(*result)
if __name__ == "__main__":
main()