Algorithm15 倍增
[TOC]
倍增
拼凑砝码
https://www.luogu.com.cn/problem/P2347
#include <iostream>
using namespace std;
int w[8] = {1, 2, 3, 5, 10, 20}, t;
#include <bitset>
bitset<1010> s;
int main() {
s[0] = 1;
for (int i = 0; i < 6; ++i) {
scanf("%d", &t);
for (int j = 0; j < t; ++j) s |= s<<w[i];
}
printf("Total=%d\n", s.count()-1);
return 0;
}