AC(很简单)
2024-09-14 20:23:01
发布于:北京
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int a[7], b[7] = {0, 1, 2, 3, 5, 10, 20};
bool dp[1001];
int main() {
for (int i = 1; i <= 6; i++)
cin >> a[i];
dp[0] = 1;
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= a[i]; j++) {
for (int k = 1000; k >= 0; k--) {
dp[k + b[i]] |= dp[k];
}
}
}
int cnt = 0;
for (int i = 1; i <= 1000; i++) {
if (dp[i]) cnt++;
}
printf("Total=%d", cnt);
return 0;
}
这里空空如也
有帮助,赞一个