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

建议使用的浏览器:

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

5201:The Monkey King

题目描述
As everyone known, The Monkey King is Son Goku. He and his offspring live in Mountain of Flowers and Fruits. One day, his sons get $n$ peaches. And there are $m$ monkeys (including GoKu), they are numbered from $1$ to $m$, GoKu’s number is 1. GoKu wants to distribute these peaches to themselves. Since GoKu is the King, so he must get the most peach. GoKu wants to know how many different ways he can distribute these peaches. For example n=2, m=3, there is only one way to distribute these peach: 2 0 0.

When given $n$ and $m$, you are expected to calculate how many different ways GoKu can distribute these peaches. Answer may be very large, output the answer modular $1000000007$ instead.
输入解释
There are multiple test cases. In the first line of the input file there is an integer $T$ indicates the number of test cases.

In the next $T$ lines, each line contains $n$ and $m$ which is mentioned above.

[Technical Specification]

All input items are integers.

$1 \leq T \leq 25$

$1 \leq n,m \leq 100000$
输出解释
For each case,the output should occupies exactly one line.

See the sample for more details.
输入样例
2
2 2
3 5
输出样例
1
5

提示
For the second case, there are five ways. They are
2 1 0 0 0
2 0 1 0 0
2 0 0 1 0
2 0 0 0 1
3 0 0 0 0
来自杭电HDUOJ的附加信息
Recommend hujie

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

源链接: HDU-5201

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

共提交 0

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