total = [3, 3, 2]
max = [[10, 5, 3], [3, 2, 2], [9, 0, 2], [2, 2, 2], [4, 3, 3]]
alread = [[0, 1, 0], [2, 0, 0], [3, 0, 2], [2, 1, 1], [0, 0, 2]]
need = [[10, 4, 3], [1, 2, 2], [6, 0, 0], [0, 1, 1], [4, 3, 1]]
remember = []
select = [0, 0, 0, 0, 0]
n = 0
while n <= 2:
for i in need:
if total[0] >= i[0] and total[1] >= i[1] and total[2] >= i[2]:
a = need.index(i)
if select[a] == 0:
select[a] = 1
total[0] = total[0] + alread[a][0]
total[1] = total[1] + alread[a][1]
total[2] = total[2] + alread[a][2]
remember.append(a)
n = n + 1
print('分配次序为:', remember)
print("可用资源", total)