Dollars (simple DP)

Source: Internet
Author: User
J-dollars Time limit:3000 Ms Memory limit:0 KB 64bit Io format:% LLD & % llusubmitstatus

Description


Dollars

New Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50C, 20C, 10c and 5C coins. write a program that will determine, for any given amount, in how many ways that amount may be made up. changing the order of listing does not increase the count. thus 20c may be made up in 4 ways: 1 20C, 2 10C, 10C + 2 5C, and 4 5C.

Input

Input will consist of a series of real numbers no greater than $300.00 each on a separate line. each amount will be valid, that is will be a multiple of 5C. the file will be terminated by a line containing zero (0.00 ).

Output

Output will consist of a line for each of the amounts in the input, each line consisting of the amount of money (with two decimal places and right justified in a field of width 6 ), followed by the number of ways in which that amount may be made up, right justified in a field of width 17.

Sample Input
0.202.000.00
Sample output
0.20 4 2.00 293 simple DP. Note that the double type cannot be forcibly converted. Note that the data input has the following features: use an integer to read data. AC code:
# Include <iostream> # include <cstdio> using namespace STD; long DP [33000]; int A [15] = {5, 10, 20, 50, 100,200,500,100 }; int main () {// freopen ("in.txt", "r", stdin); // double S, N; DP [0] = 1; for (INT I = 0; I <11; I ++) for (Int J = 5; j <= 30000; j + = 5) if (j> = A [I]) DP [J] + = DP [J-A [I]; int A, B; while (~ Scanf ("% d. % d ", & A, & B) // you cannot use double to read {long x = A * 100 + B; If (x = 0) break; printf ("% 6.2lf % 17lld \ n", (double) x/100.0, DP [x]);} return 0 ;}


Dollars (simple DP)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.