题意:还是凑钱问题
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 30005;
int money[5] = {1,5,10,25,50};
long long dp[MAXN];
int main(){
memset(dp,0,sizeof(dp));
dp[0] = 1;
for (int i = 0; i < 5; i++)
for (int j = money[i]; j < MAXN; j++)
dp[j] += dp[j - money[i]];
int n;
while (scanf("%d",&n) != EOF){
if (dp[n] == 1)
printf("There is only 1 way to produce %d cents change.\n",n);
else printf("There are %lld ways to produce %d cents change.\n",dp[n],n);
}
return 0;
}