CF1516E.Baby Ehab Plays with Permutations
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
This time around, Baby Ehab will play with permutations. He has n cubes arranged in a row, with numbers from 1 to n written on them. He'll make exactly j operations. In each operation, he'll pick up 2 cubes and switch their positions.
He's wondering: how many different sequences of cubes can I have at the end? Since Baby Ehab is a turbulent person, he doesn't know how many operations he'll make, so he wants the answer for every possible j between 1 and k.
这一次,Baby Ehab 将与排列(permutation)进行游戏。他有 n 个立方体排成一行,上面分别写有数字 1 到 n。他将恰好执行 j 次操作。在每次操作中,他将挑选出 2 个立方体并交换它们的位置。
他思考着:最终可能得到多少种不同的立方体序列?由于 Baby Ehab 是一个反复无常的人,他并不知道自己究竟会执行多少次操作,因此他希望得到每个可能的 j(从 1 到 k)所对应的答案。
输入格式
The only line contains 2 integers n and k (2≤n≤109, 1≤k≤200) — the number of cubes Baby Ehab has, and the parameter k from the statement.
唯一一行包含 2 个整数 n 和 k(2≤n≤109,1≤k≤200)——分别表示 Baby Ehab 拥有的立方体数量,以及题目描述中的参数 k。
输出格式
Print k space-separated integers. The i-th of them is the number of possible sequences you can end up with if you do exactly i operations. Since this number can be very large, print the remainder when it's divided by 109+7.
输出 k 个以空格分隔的整数。其中第 i 个整数表示恰好执行 i 次操作后可能得到的不同序列的数量。由于该数量可能非常大,请输出其对 109+7 取模的结果。
输入输出样例
输入#1
2 3
输出#1
1 1 1
输入#2
3 2
输出#2
3 3
输入#3
4 2
输出#3
6 12
说明/提示
In the second example, there are 3 sequences he can get after 1 swap, because there are 3 pairs of cubes he can swap. Also, there are 3 sequences he can get after 2 swaps:
- [1,2,3],
- [3,1,2],
- [2,3,1].
在第二个例子中,经过 1 次交换后,他可以得到 3 个不同的序列,因为共有 3 对立方体可以交换。此外,经过 2 次交换后,他也可以得到 3 个不同的序列:
- [1,2,3],
- [3,1,2],
- [2,3,1]。
输入解题思路,AI测评打分。不知道怎么写?