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

建议使用的浏览器:

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

3441:Rotation

题目描述
As you know, AekdyCoin loves games.One day,he got a small square board such as the one in Figure 1,the length of side is A (Here A is an integer!).
Now AekdyCoin has C different color, he uses these color to paint the A * A board above. You could see a possible painted board in Figure 2.
If one board could be rotated to another board (both painted), we consider them as the same, just as you could see in the figure 3。
Now,AekdyCoin cut the A*A board into A*A small square boards whose length of side is exactly 1.
Then AekdyCoin combine some squares to some new B*B squares(as many as possible),here :
B * B * K + 1 = A * A, (K >= 0)
in the figure 5, there are two possible ways, B = 1 or B = 2
Then AekdyCoin connect the left one 1 * 1 square to other B * B square(s), as in the figure 6
But all the state you get if you rotate any B * B square(s) or rotate the figure around the left one 1 * 1 square are considered as the same. For example, all the states in Figure 7 are same.
Now AekdyCoin want to know the unique state he could get if he try any possible combination .(That means he will try all possible B)
输入解释
The first line is an integer T indicates the number of the cases. ( T <= 1000)
Then T lines
A C
Indicate the value of A and the kind of colors AekdyCoin has. (1<=A,C<=10^9)
输出解释
Output a single integer indicates the remainder of the answer after divided by 1000000007
输入样例
2
2 7
3 2
输出样例
Case 1: 833
Case 2: 114
来自杭电HDUOJ的附加信息
Author AekdyCoin
Recommend

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

源链接: HDU-3441

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

共提交 0

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