当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6503:Problem D. Permutation

题目描述
An array P = [$p_1$, $p_2$, ..., $p_n$] is a “n-permutation”, if and only if all pi are in [1, n] and distinct.
For a n-permutation P, we define a transform function F on P: F(X) = [$X_{p_1}$, $X_{p_2}$, ..., $X_{p_n}$]. The result is obviously also a n-permutation.
It is not hard to find that if we apply F on P repeatedly, the result will be same as the original P at certain time. Formally, we define $F^0$(X) = X, and $F^{i+1}$(X) = F($F^i$(X)), then we use G(P) to represent
the minimum positive number which satisfy $F^{G(P)}$(X) == X. (Two n-permutations are equal (“==”), ifand only if their corresponding elements are equal. )
Among all n! different n-permutations, how many distinct values of G are there?
输入解释
Input is given from Standard Input in the following format:
T
$n_1$
$n_2$
...
...
...
$n_T$
Constraints
1 ≤ T ≤ 3000
1 ≤ n ≤ 3000
输出解释
Print T line denotes the answers.
Each line contains the number of distinct values of G($P_i$), where $P_i$ enumerates all $n_i$-permutations.
The answer maybe very large, you should modulo 1000000007(10^9 + 7)
输入样例
3
1
2
3
输出样例
1
2
3
来自杭电HDUOJ的附加信息
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6503

最后修改于 2020-10-25T23:31:54+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)