#P4013. 数字梯形问题
数字梯形问题
Description
Given a number trapezoid with rows as shown in the figure.

The first row of the trapezoid contains numbers. Starting from each of the numbers in the top row, you may move at each step to the lower-left or lower-right adjacent number, forming a path from the top to the bottom of the trapezoid.
Respect the following rules respectively:
- The top-to-bottom paths are pairwise disjoint (no common nodes or edges).
- The top-to-bottom paths may intersect only at numeric nodes (shared nodes allowed, shared edges not allowed).
- The top-to-bottom paths may intersect at numeric nodes or along edges (both nodes and edges may be shared).
Input Format
The first line contains two positive integers and , denoting that the first row of the number trapezoid has numbers and there are rows in total. The next lines give the numbers in each row of the trapezoid.
Row has numbers, row has numbers, and so on.
Output Format
Output the maximum total sum computed under Rule , Rule , and Rule , respectively, one maximum sum per line.
2 5
2 3
3 4 5
9 10 9 1
1 1 10 1 1
1 1 10 12 1 1
66
75
77
Hint
.
Translated by ChatGPT 5
京公网安备 11011102002149号