1. 程式人生 > >51 nod 1101 換零錢

51 nod 1101 換零錢

using src splay hid -a one pla define iostream

技術分享圖片
 1 #include <iostream>
 2 using namespace std;
 3 #define mod 1000000007
 4 int dp[100005];
 5 
 6 int main()
 7 {
 8     int a[]={1,2,5,10,20,50,100,200,500,1000,2000,5000,10000};
 9     int n;
10     cin>>n;
11     dp[0] = 1;
12     for (int i=0;i<13;i++)
13     {
14         for (int j=a[i];j<=n;j++)
15             dp[j] = (dp[j]+dp[j-a[i]])%mod;
16 } 17 cout<<dp[n]<<endl; 18 }
View Code

51 nod 1101 換零錢