#P8783. [蓝桥杯 2022 省 B] 统计子矩阵
[蓝桥杯 2022 省 B] 统计子矩阵
Problem Description
Given an matrix , please count how many submatrices (minimum , maximum ) satisfy that the sum of all numbers in the submatrix does not exceed the given integer .
Input Format
The first line contains three integers , , and .
Then there are lines, each containing integers, representing the matrix .
Output Format
Output one integer representing the answer.
3 4 10
1 2 3 4
5 6 7 8
9 10 11 12
19
Hint
[Sample Explanation]
There are submatrices that satisfy the condition, including:
There are of size .
There are of size .
There are of size .
There is of size .
There are of size .
[Test Case Scale and Constraints]
For of the testdata, .
For of the testdata, .
For of the testdata, , , .
Lanqiao Cup 2022 Provincial Contest B Group, Problem F.
Translated by ChatGPT 5