4 条题解
-
0
def solve(): n, m, k = map(int, input().split()) a = [[0] * (m + 1) for _ in range(n + 1)] for i in range(1, n + 1): row = list(map(int, input().split())) for j in range(1, m + 1): a[i][j] = row[j - 1] + a[i - 1][j] ans = 0 for i in range(1, n + 1): for j in range(i, n + 1): l = 1 cur = 0 for r in range(1, m + 1): cur += a[j][r] - a[i - 1][r] while cur > k: cur -= a[j][l] - a[i - 1][l] l += 1 ans += r - l + 1 print(ans) if __name__ == "__main__": solve()
信息
- ID
- 971
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 64
- 已通过
- 14
- 上传者