#P9411. 『STA - R2』Gtrimee
『STA - R2』Gtrimee
Problem Description
Let be the number of ordered rooted unlabeled trees whose children are ordered and that satisfy the following conditions:
- The number of nodes .
- All nodes with depth are not leaves.
Given a fixed positive integer , and then given a positive integer multiple times, compute .
Here, the depth of a node is defined as the length of the unique simple path from it to the root. For example, the depth of the root is .
Input Format
This problem has multiple queries.
The first line contains a positive integer , indicating the Subtask ID.
The second line contains two positive integers , where is the number of queries.
The next lines each contain one positive integer , describing a query.
Output Format
Output lines. Each line should be for the corresponding query.
0
5 2
1
2
3
4
5
1
2
3
5
10
0
5 200
1
10
100
1000
10000
1
6918
721868074
972431902
815282281
Hint
Sample Explanation
Explanation for Sample 1:
When , all valid trees with exactly nodes are:

Constraints
This problem uses bundled testdata.
$$\newcommand{\arraystretch}{1.5} \begin{array}{c|c|c|c}\hline\hline \textbf{Subtask} & \bm{n}\le & \textbf{Score} & \textbf{Special Properties}\\\hline \textsf{1} & 5 & 5 \\\hline \textsf{2} & 10^2 & 20\\\hline \textsf{3} & 2\times10^5 & 35 & k=1\\\hline \textsf{4} & 2\times10^5 & 40\\\hline\hline \end{array}$$For all testdata, .
Translated by ChatGPT 5