#QHD0000064. Đổi tiền đô la New Zealand (Dollars)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Đổi tiền đô la New Zealand (Dollars)
Dollars
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
New Zealand currency has banknotes worth , , , , and dollars, and coins worth and dollars, and , , , and cents. You have an unlimited number of each denomination.
Two ways to make an amount are considered the same if they use exactly the same quantity of every denomination, regardless of the order of the notes and coins. For example, dollars can be formed in four ways: one -cent coin; two -cent coins; one -cent coin plus two -cent coins; or four -cent coins.
Given an amount written in dollars with exactly two decimal digits, count the number of different combinations of notes and coins that sum to exactly . Print the exact count, without a modulus, and preserve the specified right-aligned output columns. Every amount is a multiple of dollars.
Input
One amount on a line, containing exactly two digits after the decimal point (for example 2.00 or 0.20). There is no terminating 0.00 record in this version.
Output
Print exactly one line containing two adjacent fields: first the amount with two fractional digits, right-aligned in a field of width ; then the exact number of combinations, right-aligned in a field of width . Insert no extra separator apart from the padding spaces. Use an integer type wide enough for the answer.
Subtasks
-
Subtask 1 (20 points): dollars, with a multiple of and exactly two fractional digits.
-
Subtask 2 (30 points): dollars, with a multiple of and exactly two fractional digits.
-
Subtask 3 (50 points): dollars, with a multiple of and exactly two fractional digits.
Examples
Input
0.20
Output
0.20 4
Explanation
The amount 0.20 is cents. The only usable denominations are , , and cents. The four combinations are: ; ; ; and . Thus the count is . The text 0.20 occupies four characters and receives two leading spaces in its six-character field; the integer 4 is right-aligned within the following seventeen-character field.