-->
当前位置:首页 > 题库

PROGRAMMING:Grid access

Luz5年前 (2021-05-10)题库402
In a chessboard with $$m times n $$squares, there is a positive integer in each square.
Now we need to get the number from the grid, so that there is no common edge in the grid where any two numbers are located, and the sum of the numbers taken out is the largest. Try to design a data access algorithm to meet the requirements.
###Input format:
The first line of the file has two positive integers $$M $$and $$n $$, which respectively represent the number of rows and columns of the chessboard. The next $$M $$line, each line has $$n $$positive integers, representing the number in the chessboard square.
Note: $$M $$is the number of rows and $$n $$is the number of columns.
The data is guaranteed to be $$1 / Leq n, M / Leq 30$$
###Output format:
The maximum sum of output fetches.
###Input example:
Here is a set of inputs. For example:
```in
3 3
1 2 3
3 2 3
2 3 1
```
###Output example:
The corresponding output is given here. For example:
```out
eleven
```







answer:If there is no answer, please comment