Problem3042--B. 凑硬币

3042: B. 凑硬币

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

有 lns="http://www.w3.org/1998/Math/MathML">5 分、lns="http://www.w3.org/1998/Math/MathML">2 分、lns="http://www.w3.org/1998/Math/MathML">1 分的硬币无限多,从中取 lns="http://www.w3.org/1998/Math/MathML">n 枚硬币,凑成 lns="http://www.w3.org/1998/Math/MathML">m 分钱,有多少种不同的方法?

例如, lns="http://www.w3.org/1998/Math/MathML">n = lns="http://www.w3.org/1998/Math/MathML">5lns="http://www.w3.org/1998/Math/MathML">m = lns="http://www.w3.org/1998/Math/MathML">13 时,有以下两种方法:

  1. lns="http://www.w3.org/1998/Math/MathML">1 个 lns="http://www.w3.org/1998/Math/MathML">5 分,lns="http://www.w3.org/1998/Math/MathML">4 个 lns="http://www.w3.org/1998/Math/MathML">2 分,lns="http://www.w3.org/1998/Math/MathML">0 个 lns="http://www.w3.org/1998/Math/MathML">1 分。

  2. lns="http://www.w3.org/1998/Math/MathML">2 个 lns="http://www.w3.org/1998/Math/MathML">5 分,lns="http://www.w3.org/1998/Math/MathML">0 个 lns="http://www.w3.org/1998/Math/MathML">2 分,lns="http://www.w3.org/1998/Math/MathML">3 个 lns="http://www.w3.org/1998/Math/MathML">1 分。

某种面值的硬币数量可以是 lns="http://www.w3.org/1998/Math/MathML">0,但不能是负数。输入 lns="http://www.w3.org/1998/Math/MathML">n 和 lns="http://www.w3.org/1998/Math/MathML">m ,计算凑成 lns="http://www.w3.org/1998/Math/MathML">m 分钱的方法数,当然也可能无法凑成 lns="http://www.w3.org/1998/Math/MathML">m 分钱,方法数是 lns="http://www.w3.org/1998/Math/MathML">0

Input

第一行一个正整数 lns="http://www.w3.org/1998/Math/MathML">n 。

第二行一个正整数 lns="http://www.w3.org/1998/Math/MathML">m 。

Output

一个整数,为 lns="http://www.w3.org/1998/Math/MathML">n 枚硬币凑成 lns="http://www.w3.org/1998/Math/MathML">m 分钱的方法数。

Sample Input Copy

5
13

Sample Output Copy

2

HINT

样例2输入:

7
10

样例2输出:

1

【样例解释】

见题目描述。

【数据范围】

lns="http://www.w3.org/1998/Math/MathML">n \leq 30

lns="http://www.w3.org/1998/Math/MathML">n \leq m \leq 5 \times n 。

Source/Category