#QHD0000068. Đổi tiền bằng các số lập phương (Ingenuous Cubrency)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Đổi tiền bằng các số lập phương (Ingenuous Cubrency)
Ingenuous Cubrency
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Cubeland uses coins of denominations , that is, . Every denomination has an unlimited supply.
For a positive integer amount , count the number of combinations of coins summing to exactly . Two selections are different only when their multiplicities for at least one denomination differ; the order of coins does not matter. Return the exact integer, not a value modulo a constant. For example, amount can be represented as ones, one eight and ones, or two eights and ones, giving three ways.
Input
One line contains the positive integer .
Output
Print the exact number of unordered cubic-coin combinations, using a 64-bit integer; do not take a modulus.
Subtasks
- Subtask 1 (20 points): ; 21 denominations for , unlimited supply.
- Subtask 2 (30 points): ; 21 denominations for , unlimited supply.
- Subtask 3 (50 points): ; 21 denominations for , unlimited supply.
Examples
Input
21
Output
3
Explanation
Only and can be used for . Taking zero, one or two -coins yields three combinations, with the rest filled by ones.