Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
RESTRUCTURADO
def length(sizes, goal): remainders = [] containers = [] container = [] fill = goal for size in sizes: qty = min(fill // size[0], size[1]) fill = fill - (qty * size[0]) remainders.append((size[0], size[1] - qty)) container.append((size[0], qty)) if any([size[1] for size in sizes]): containers = length(remainders, goal); else: return containers containers.append((container, fill)) return containers if __name__ == '__main__': sizes = [ (45.75,5), (2.75, 5), # (MEDIDA DEL CORTE , CANTIDAD DE TUBOS) (22.25, 5), #SE AGREGA UN '(00 , 00), POR CADA CORTE NUEVO QUE SE HARA ] dist = list(reversed(length(sorted(sizes,reverse=True),156))) for elem in dist: print("Distribución de cortes: {} / Espacio restante en contenedor: {}".format(elem[0], elem[1]))
run
|
edit
|
history
|
help
0
Rhymes child
print
Depth First Search - Find if path exists
Implement a stack by using an array
sensi cod
Gh
square cube function
9th jan quiz2
sen
(P3) Zadanie Kolokwium 2013: Trójkąty i trójkąty