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

PROGRAMMING:Several towers

Luz5年前 (2021-05-10)题库396
As we all know, lfq is the little prince of DP. On that day, he thought JZK, ZWG and CGL were too delicious, so he decided to make a proposal to test them. The question is like this.
JZK, ZWG, CGL can't do this problem, but they don't want lfq to think they are very good, so I want to ask you, can you help him solve this problem?
When describing the DP algorithm, a classic example is the number tower problem, which is described as follows:
There are several towers as shown below. It is required to go from the top to the bottom. If each step can only go to the adjacent nodes, what is the maximum sum of the number of nodes?
I've already told you that it's a topic of DP. Can you help me?
(all data shall not exceed 100)
![ 123.jpg](~/eb359a2d-aabf-4583-8f59-98dacdfe5f1c.jpg)
###Input format:
The input data first includes an integer C, which represents the number of test cases. The first line of each test case is an integer n (1 < = n < = 100), which represents the height of the data tower. Next, N lines of numbers are used to represent the data tower, in which the i-th line has I integers, and all integers are in the interval [0,99].
###Output format:
For each test instance, output the maximum sum that can be obtained, and the output of each instance occupies one line.
###Input example:
Here is a set of inputs. For example:
```in
one
five
seven
3 8
8 1 0
2 7 4 4
4 5 2 6 5
```
###Output example:
The corresponding output is given here. For example:
```out
thirty
```







answer:If there is no answer, please comment