先上代码:后面再细讲
class yinhangjia(object):
"""sum_num为资源类型数量"""
"process_num为进程数量"
process_num = 5
sum_num = 3
# T=0似乎没有必要
def __init__(self):
self.available = [0 for _ in range(yinhangjia.sum_num)]
self.Max = [[0 for _ in range(yinhangjia.sum_num)] for _ in range(yinhangjia.process_num)]
self.allocation = [[0 for _ in range(yinhangjia.sum_num)] for _ in range(yinhangjia.process_num)]
self.need = [[0 for _ in range(yinhangjia.sum_num)] for _ in range(yinhangjia.process_num)]
print("please input {0} pcs account:".format(yinhangjia.sum_num))
for i in range(yinhangjia.sum_num):
self.available[i] = int(input())
print("please input max matrix:")
for i in range(yinhangjia.process_num):
print("please input {0} process' max".format(i))
f