From 7bc83bc42a701323b08022e323627f9d20d37ae0 Mon Sep 17 00:00:00 2001 From: Juan Sanchez Date: Mon, 13 Feb 2023 18:41:12 -0600 Subject: [PATCH] 3DPrinting python solution uploaded --- solutions/3DPrinting/python/3DPrinting.py | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 solutions/3DPrinting/python/3DPrinting.py diff --git a/solutions/3DPrinting/python/3DPrinting.py b/solutions/3DPrinting/python/3DPrinting.py new file mode 100644 index 00000000..9dbfecae --- /dev/null +++ b/solutions/3DPrinting/python/3DPrinting.py @@ -0,0 +1,44 @@ +#Sanchez Palacios +#Google codejam 2020 3DPrinting +import sys + +T = int(input()) + +for i in range (0,T): + + C = [] + M = [] + Y = [] + K = [] + + for j in range(0,3): + printer = list(input().split(" ")) + C.append(int(printer[0])) + M.append(int(printer[1])) + Y.append(int(printer[2])) + K.append(int(printer[3])) + + tinta = [min(C),min(M),min(Y),min(K)] + + Total = tinta[0] + tinta[1] + tinta[2] + tinta[3] + P = 1000000 + + if(Total >= 1000000): + res = "\nCase #" + str(i+1) + ": " + z = 0 + for i in range (0,4): + if P > tinta[i] and P > 0: + res += str(tinta[i]) + " " + P -= tinta[i] + elif P > 0: + res += str(P) + " " + P -= P + else: + res += " 0 " + z += 1 + print(res+"\n") + else: + print("\nCase #" + str(i+1) + ": IMPOSSIBLE \n") + sys.stdout.flush() + +