/*
* 完全背包問題,裸題,不多解釋
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAXN 8000
#define COINTYPE 5
int coin_type[] = {50, 25, 10, 5, 1};
unsigned int dp[MAXN];
unsigned int complete_knapsack(int n)
{
register int i, v;
memset(dp, 0, sizeof(dp));
dp[0] = 1;
for(i = 0; i < COINTYPE; i ++) {
for(v = 0; v <= n; v ++) {
if( dp[v] ) {
dp[v+coin_type[i]] += dp[v];
}
}
}
return dp[n];
}
int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
freopen("test.in", "r", stdin);
#endif
int n;
while( ~scanf("%d", &n) ) {
printf("%d\n", complete_knapsack(n));
}
return 0;
}
uva_674
最新推荐文章于 2019-11-08 16:27:07 发布