代码
from unittest.mock import patchclass Solution:def func(self, number, days, item_max_num, item_price):max_money = 0for i in range(number):max_money += item_max_num[i] * self.compute_max_price(item_price[i])print(max_money)return max_moneydef compute_max_price(self, price_list):max_price = 0left_price = price_list[0]right_price = price_list[0]for cur_price in price_list[1:]:if cur_price > right_price:right_price = cur_priceelse:max_price += (right_price - left_price)left_price = cur_priceright_price = cur_priceif left_price != right_price:max_price += (right_price - left_price)print(price_list, max_price)return max_pricedef input_args():number = int(input('number:'))days = int(input('days:'))item_max_num = list(map(int, input('item price:').split()))item_price = []for i in range(days):item_price.append(list(map(int, input('item price:').split())))return number, days, item_max_num, item_pricemock_input_lst = ["3","3","4 5 6","1 2 3","4 3 2","1 5 3",
]
with patch('builtins.input', side_effect=mock_input_lst):number, days, item_max_num, item_price = input_args()
s = Solution()
s.func(number, days, item_max_num, item_price)