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

建议使用的浏览器:

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

3985:Harry Potter and the D.A.

题目描述
D.A., short for Dumbledore's Army, is found by Harry while fighting with Voldemort. In the last battle, the D.A. has contributed greatly to smashing the Death Eater. Before this, Harry Potter had trained them a lot about defensing against the Dark Arts.

For easy recognizing, each of the D.A. has a unique ID, from 1 to N. At ordinary time, they lined up by a certain order. But in Harry’s memory, there was one day they messed up, so he asked them to change their position. At first, he use the magic to remember all pairs, e.g. if the i-th ID is pi, Harry would commit the pair to memory. Then, in each round, he would require the pi-th magician to stand in the i-th place. By doing this again and again, after exactly K round, he found the ID sequence is the same as the original, and what’s more, it’s the first time they all come back!
But unfortunately, Harry can’t remember the ID sequence on that day, so he asks you for help, to calculate the number of permutations fitting this situation.
输入解释
The first line contains a single integer T, indicating the number of test cases.
Each test case contains two integers, N and K.

Technical Specification

1. 1 <= T <= 50
2. 1 <= N <= 100
3. 1 <= K <= 1 000 000 000
输出解释
For each test case, output the case number first, then the answer mod 1 000 000 007.
输入样例
2
1 1
3 3
输出样例
Case 1: 1
Case 2: 2
来自杭电HDUOJ的附加信息
Author iSea@WHU
Recommend lcy

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

源链接: HDU-3985

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

共提交 0

通过率 --%
时间上限 内存上限
15000/10000MS(Java/Others) 65536/65536K(Java/Others)