http://oj.tsinsen.com/A1104
#include "bits/stdc++.h"
using namespace std;
const int v[6] = { 1, 2, 3, 5, 10, 20 };
int Can[1050] = { 1 }, cnt[6], sup, res;
int main() {
for (int i = 0; i < 6; ++i) {
scanf("%d", &cnt[i]);
sup += cnt[i] * v[i];
}
for (int i = 0; i < 6; ++i)
for (int j = 0; j < cnt[i]; ++j)
for (int k = sup; k >= v[i]; --k)
Can[k] |= Can[k - v[i]];
for (int i = 1; i <= sup; ++i)
res += Can[i];
printf("Total=%d\n", res);
return 0;
}