dp处理子集问题
dp 【 i 】 表示合成 i 元的方法种数
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<stack>
#include<map>
#define PI acos(-1.0)
#define in freopen("in.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 30000 + 7, maxd = (1<<18)-1, mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;
double n;
int m[17] = {0,5,10,20,50,100,200,500,1000,2000,5000,10000};
ll dp[maxn];
int main() {
memset(dp, 0, sizeof dp);
dp[0] = 1;
for(int i = 1; i <= 11; ++i) {
for(int j = m[i]; j <= maxn; ++j) {
dp[j] += dp[j-m[i]];
}
}
while(~scanf("%lf", &n) && n) {
printf("%6.2lf%17lld\n", n, dp[int(n*100+0.5)]);
}
return 0;
}