"Dynamic planning" currency system issues

Source: Internet
Author: User

"Dynamic planning" currency system issue time limit: 1 Sec memory limit: up to MB Title Descriptionmoney is a special commodity that acts as an equivalent in the exchange of goods and services in the state or economy, or as a debt-servicing instrument, and is used as a tool for trading media, storage value and accounting units. The history of the Wizarding world's currency can be traced back to the prehistoric stage of barter, later through the metal currency, gold and silver, banknotes and gold and silver standard system, evolved into the modern monetary system, now known as the Magic world of the monetary system has v face value, for the composition of the value of the currency of n how many kinds of solutions. InputThe first behavior of two integers V and n,v is the number of currency types, 1≤v≤25,n is the face value to construct, 1≤n≤1000.
The second act is the face value of the V currency. OutputThe number of output scenarios. Sample input
3 101 2 5
Sample output
10

#include <iostream>#include<cstring>using namespacestd;intn,m,a[ -],f[1111];intMain () { while(cin>>n>>m) { for(intI=0; i<n;i++) Cin>>A[i]; Memset (F,0,sizeof(f)); f[0]=1;  for(intI=0; i<n;i++)             for(intj=a[i];j<=m;j++) {F[j]=f[j]+f[j-A[i]]; } cout<<f[m]<<Endl; }    return 0;}

"Dynamic planning" currency system issues

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.