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

PROGRAMMING:Digital trapezoid

Luz5年前 (2021-05-10)题库452
Given a number ladder composed of $$n $$rows of numbers, as shown in the figure below. The first line of the ladder has $$M $$numbers. Starting from the number of $$M $$at the top of the trapezoid, you can move along the left or right bottom direction at each number to form a path from the top to the bottom of the trapezoid.
Observe the following rules respectively:
1. $$M $$paths from the top to the bottom of the trapezoid do not intersect each other;
2. The paths from the top to the bottom of the trapezoid intersect only at the digital node;
3. $$M $$paths from the top to the bottom of the trapezoid are allowed to intersect at digital nodes or edges.
![ 20170306220732898.jpeg](~/6c2291b7-559c-4cb9-ae70-0630a151acbb.jpeg)
###Input format:
There are two positive integers $$M $$and $$n $$in the $$1 $$line, which respectively indicate that there are $$M $$numbers in the first line of the number ladder, and there are totally $$n $$lines. The next $$n $$row is the number of each row in the number ladder.
There are $$M $$numbers in line $$1 $, and $$m + 1 $$numbers in line $$2 $$$
The data is guaranteed to be $$1 / Leq n, M / Leq 20$$
###Output format:
The maximum sum of numbers calculated according to rule $$1 $$, rule $$2 $$, and rule $$3 $$is output, one for each line.
###Input example:
Here is a set of inputs. For example:
```in
2 5
2 3
3 4 5
9 10 9 1
1 1 10 1 1
1 1 10 12 1 1
```
###Output example:
The corresponding output is given here. For example:
```out
sixty-six
seventy-five
seventy-seven
```







answer:If there is no answer, please comment