#P4161. [SCOI2009] 游戏
[SCOI2009] 游戏
Description
windy has learned a game.
For the numbers from to , each number is mapped to a unique and different number from to (i.e., a permutation).
At the beginning, windy writes the numbers in order in a row on paper.
Then, underneath this row, he writes their corresponding numbers.
Next, underneath the new row, he writes the numbers corresponding to that row.
He repeats this process until the sequence becomes again.
For example: .
The correspondence is: , , , , , .
windy operates as follows:
1 2 3 4 5 6
2 3 1 5 4 6
3 1 2 4 5 6
1 2 3 5 4 6
2 3 1 4 5 6
3 1 2 5 4 6
1 2 3 4 5 6
At this point, we have several rows of permutations of to ; in the example there are rows.
Now windy wants to know: over all possible correspondences, how many different possible numbers of rows are there.
Input Format
A single integer, .
Output Format
A single integer, the number of possible row counts.
3
3
10
16
Hint
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号