# matrix = [[0 for _ in range(m + 1)]] + [[0] for _ in range(n)] # # print(matrix) # for i in range(n): # matrix[i + 1].extend(map(int, input().split())) # # print(matrix) # # 计算前缀和 # pre_sum = [[0 for _ in range(m+1)] for _ in range(n+1)] # for i in range(1,n + 1): # for j in range(1,m + 1): # pre_sum[i][j]=pre_sum[i-1][j]+pre_sum[i][j-1]-pre_sum[i-1][j-1]+matrix[i][j]
# 因为后面用不到原始矩阵值,所以用另一种初始化前缀和的方法 pre_sum = [[0for _ inrange(m + 1)]] for i inrange(1, n + 1): pre_sum.append([0] + list(map(int, input().split()))) for j inrange(1, m + 1): pre_sum[i][j] += pre_sum[i - 1][j] + pre_sum[i][j - 1] - pre_sum[i - 1][j - 1]
# for i in pre_sum: # print(i)
res = 0 for i1 inrange(1, n + 1): for i2 inrange(i1, n + 1): z = 0 j1 = 1 for j2 inrange(1, m + 1): while pre_sum[i2][j2] - pre_sum[i1 - 1][j2] - pre_sum[i2][j1 - 1] \ + pre_sum[i1 - 1][j1 - 1] > k: # 某一个的区间和比k大了,移动j1,缩小区间 j1 += 1 # print("z=",z,i1, i2, j1, j2) # print(i1, i2, j1, j2) res += j2 - j1 + 1 print(res)
n, m, k = map(int, input().split()) a = [[0] for i inrange(n)] a.insert(0, [0] * (m + 1)) for i inrange(1, n + 1): # 从a[1][]开始,读矩阵 a[i].extend(map(int, input().split())) s = [[0] * (m + 1) for i inrange(n + 1)] for i inrange(1, n + 1): for j inrange(1, m + 1): s[i][j] = s[i - 1][j] + a[i][j] ans = 0 for i in s: print(i) for i1 inrange(1, n + 1): for i2 inrange(i1, n + 1): j1 = 1; z = 0 for j2 inrange(1, m + 1): z += s[i2][j2] - s[i1 - 1][j2] while z > k: z -= s[i2][j1] - s[i1 - 1][j1] j1 += 1 ans += j2 - j1 + 1 print(i1, i2, j1, j2, j2 - j1 + 1, z) print(ans)