https://vjudge.net/problem/UVA-147
题意:
换零钱,计算方案数。
思路:
完全背包,UVa674的加强版。
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std; const int maxn = + ;
int coin[] = { , , , , , , , , , , };
long long d[maxn]; int main()
{
//freopen("D:\\txt.txt", "r", stdin);
int i, j;
memset(d, , sizeof(d));
d[] = ;
for (int i = ; i < ;i++)
for (int j = coin[i]; j <= maxn; j++)
d[j] += d[j - coin[i]];
double s;
while (cin >> s && s)
{
int n = (int)( * s + 0.5);
printf("%6.2lf%17lld\n", s,d[n]);
}
return ;
}