#55356: c++ dp 2dim


61247091s@gapps.ntnu.edu.tw (wei)


#include <bits/stdc++.h>
using namespace std;

long long m[30005][5];
int coin[5]={1,5,10,25,50};

long long cnt(int n,int idx){
    if(n<0)return 0;
    if(n==0)return 1;
    if(idx<0)return 0;

    if(m[n][idx]!=-1)return m[n][idx];
    long long take=cnt(n-coin[idx],idx);
    long long skip=cnt(n,idx-1);

    m[n][idx]=take+skip;

    return m[n][idx];

}

int main(){
    int num;

    memset(m,-1,sizeof(m));
    while(cin>>num){
        if(cnt(num,4)==1)cout<<"There is only 1 way to produce "<<num<<" cents change."<<endl;
        else cout<<"There are "<<cnt(num,4)<<" ways to produce "<<num<<" cents change."<<endl;
    }

    return 0;

}