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

建议使用的浏览器:

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

3503:Perfect Sequence

题目描述
A sequence <a0, a1, a2, ..., an> of integers is called a perfect sequence when all the partial sums a0, a0 + a1, a0 + a1 + a2, ..., a0 + a1 + ... + an are all positive.
Letⅴs consider a specific sequence <a0, a1, a2, ..., amn>, (ai = 1 or ai = (1-m), 1 ÷ i ÷ (m*n) ) , whose total sum is 1. Actually you can easily deduce that there are n occurrences of (1-m). So how many of these sequences are perfect sequences.
输入解释
Input contains several testcases.
For each test case, you will be given n, m (1 ÷ m, n ÷ 100000) in a single line.
Process to the end of the file.
输出解释
On each single line, output a number r mod 100000007, r is the number of perfect sequences <a0, a1, a2, ..., amn> (ai = 1 or ai = (1-m), 1 ÷ i ÷ (m*n) ) .
输入样例
4 2
5 2
3 4
输出样例
14
42
22
来自杭电HDUOJ的附加信息
Author jifeifei1989
Recommend zhengfeng

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

源链接: HDU-3503

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

共提交 0

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