题目 代码 class Solution:def func(self, input_args, area_list):count = 0for i in range(input_args[0] - input_args[2] + 1):for j in range(input_args[1] - input_args[2] + 1):count += 1 if self.area_compute(area_list,i,j,input_args[2],input_args[3]) else 0print(count)return countdef area_compute(self, area_list, x, y, length, value):compute_value = 0if length == 1:return True if area_list[x][y] >= value else Falseelse:for i in range(length):compute_value += area_list[x+i][y]if compute_value >= value:return Truefor i in range(length):compute_value += area_list[x][y+i]if compute_value >= value:return Truereturn Falses = Solution() # input_args = [2, 5, 2, 6] # area_list = [[1, 3, 4, 5, 8], [2, 3, 6, 7, 1]]input_args = [2, 5, 1, 6] area_list = [[1, 3, 4, 5, 8], [2, 3, 6, 7, 1]] s.func(input_args, area_list)