It can be found that the number on the edge will only be used once, while the number in the middle position will be used twice.
take for example
5 4
2 3 1
2+3 = 5,3+1= 4, and the last 3 was used twice to participate in the last 9 miles.
Then, in order to ensure that the top is the highest, just make sure that the number on the edge is the largest and the number inside is the smallest.
Starting from 1 (the default value of 0 cannot be used)
Here, it takes the form of an inverted triangle.
5 4 1 2 3 6
9 5 3 5 9
14 8 8 14
22 16 22
38 38
76