Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create 3d_printing.py #424

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions solutions/3d_printing/3d_printing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
def find_same_color(colors_column):
c_min = min(colors_column[0])
m_min = min(colors_column[1])
y_min = min(colors_column[2])
k_min = min(colors_column[3])

minimum = [c_min, m_min, y_min, k_min]
sum = 0
result = ""
for i, m in enumerate(minimum):
sum += m
if sum == 1000000:
result += str(minimum[i]) + " 0"*(3-i)
return result
if sum < 1000000:
result += str(minimum[i]) + " "
if sum > 1000000:
result += str(m - sum + 1000000) + " 0"*(3-i)
return result
return "IMPOSSIBLE"

def main():
printers = 3
tests = int(input())
for i in range(tests):
colors_column = [[], [], [], []]
for j in range(printers):
colors = input().split(" ")
for k, color in enumerate(colors):
colors_column[k].append(int(color))
print(f"Case #{i+1}: {find_same_color(colors_column)}")

main()