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

建议使用的浏览器:

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

5485:The Relationship in Club

题目描述
There are many student clubs in the campus, among which the Always Creatively Moha (ACM) club gained the most popularity. The ACM club consists of $N$ members. Not all of them know each other, so we may describe the relationship between two members with an integer ranging from 0 to $M$ inclusively. For example, 0 means that the two persons do not know each other. 1 may indicate that they know each other but are not familiar. 520 indicates that they have fallen into love.
The members are partitioned into two non-empty groups to participate a team-building activity. To get them know each other, it is required that the value of relationship between every pair of members in the same groups is always 0, while the relationship between persons from different groups can be any value between 0 and $M$.
It should be noted that such a partition is not always possible. For example, if there are 3 members in the club and the value of relationship between them is greater than 0, it is impossible to partition them as required.
The organizer comes up with an interesting question. Assuming we may assign any integer between 0 and $M$ to the relationship between any two members. Among all the ways of assignment, how many of them can make the partitioning possible?
输入解释
The first line of input contains a number $T$ indicating the number of test cases ($T≤100$).
Each test case consists of two integers $N$ and $M$ indicating the number of members and the maximum value of relationship ($1≤N,M≤1000$).
输出解释
For each test case, output a single line consisting of “Case #X: Y”. $X$ is the test case number starting from 1. $Y$ is the number of ways assigning value to relationships that makes the partitioning possible. As the answer could be huge, you only need to output $Y$ module 105225319.
输入样例
3
2 1
3 2
1 3
输出样例
Case #1: 2
Case #2: 19
Case #3: 0
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5485

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

共提交 0

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