PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#QHD0000050. Đổi tiền xu (Coin Change)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đổi tiền xu (Coin Change)
Coin Change
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
You must make change for cents using denominations . Every denomination has unlimited supply. Two arrangements using the same numbers of each denomination count as one combination. Count the ways to reach exactly cents. For , there is exactly one way: use no coins.
Input
A single line contains the integer amount in cents.
Output
Print the exact number of combinations without applying a modulus.
Subtasks
The independent scoring groups have the following complete constraints:
- Subtask 1 (20%): , denominations .
- Subtask 2 (30%): , denominations .
- Subtask 3 (50%): , denominations .
Examples
Input
11
Output
4
Explanation
There are four unordered combinations: , , , and eleven -cent coins. The result is .