定义
职责链模式(Chain of Responsibility Pattern)是一种行为型设计模式,它避免请求的发送者与接收者耦合在一起,让多个对象都有机会处理这个请求。将这些对象连成一条链,并沿着这条链传递请求,直到有对象…
s7
y[3,5,4,6,8,2,1]
y[8,5,4,6,7,2,1]
xy
# 把去掉最大值的y,拆分成2个list
maxymax(y)
maxyindexy.index(maxy)
chihuo[maxy]
ly y[0:maxyindex]
ry y[maxyindex 1:]
print(ly,ry)
if ly :while ly:if not ry or not ly:breakif ly[-1] > ry[-1]:chihuo.append(ly[-1]…