Files
python/TangDou/BeiBao/PlanCount/01_Above1.cpp

21 lines
418 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m;
int f[N];
int main() {
cin >> n >> m;
f[0] = 1;
for (int i = 1; i <= n; i++) {
int v;
cin >> v;
for (int j = m; j >= 0; j--)//即使物品体积比j大,j - v < 0,也能选,等价于f[0]
f[j] = f[j] + f[max(0, j - v)];
}
cout << f[m] << endl;
return 0;
}