#P2675. 《瞿葩的数字游戏》T3-三角圣地
《瞿葩的数字游戏》T3-三角圣地
Description
The center of the Kingdom of Numbers is formed by an inverted triangle.
The inverted triangle has layers. The -th layer from top to bottom contains numbers. The first layer must be one of the permutations of , that is, it must use all numbers from to without repetition. Starting from the second layer, each number is obtained by adding the two numbers above it to the left and right. For example, the following is a valid inverted triangle:
1 2 3 4
3 5 7
8 12
20
This inverted triangle has , and the last-layer number is .
The Kingdom of Numbers calls the last-layer number the 'base'. Please write a program to compute the maximum value of the 'base' modulo .
Input Format
One line containing an integer , representing the number of layers of the inverted triangle.
Output Format
One line containing an integer, which is the maximum possible 'base' for layers modulo .
4
24
1125
700
Hint
- Sample Explanation
One feasible arrangement is:
1 3 4 2
4 7 6
11 13
24
It can be proved that there is no better method.
- Constraints
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号