previous Test cut latticeTime limit: 1.0s memory limit: 256.0MB
Problem Description
As shown, a number of integers are filled in 3 x 3 squares.
+--*--+--+
|10* 1|52|
+--****--+
|20|30* 1|
*******--+
| 1| 2| 3|
+--+--+--+
We cut along the star Line in the diagram and get two parts, each with a number of 60.
The requirement of the subject is to ask you to determine whether the integer in the given m x n lattice can be divided into two parts, making the numbers and the two regions equal.
If there are multiple answers, output the minimum number of squares contained in the area containing the upper-left lattice.
If it cannot be split, the output is 0.
Input Format
The program reads in two integer m n with a space partition (M,N<10).
Represents the width and height of a table.
Next is n rows, each m positive integer, separated by a space. Each integer is not greater than 10000.
output FormatOutputs an integer representing the smallest number of squares that may be included in the upper-left corner of the partition in all solutions.
Sample Input 13 3
10 1 52
20 30 1
1 2 3
Sample Output 13
Sample Input 24 3
1 1 1 1
1 30 80 2
1 1 1 100
Sample Output 210
"Blue Bridge Cup" previous Test cut lattice (not completed)