This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m;
int f[N][N];//第一维:前i个物品,第二维:体积j及以下
int main() {
cin >> n >> m;
//初始化
for (int i = 0; i <= m; i++) f[0][i] = 1;
for (int i = 1; i <= n; i++) {
int v;
cin >> v;
for (int j = 0; j <= m; j++) {
f[i][j] = f[i - 1][j];
if (j >= v) f[i][j] += f[i - 1][j - v];
}
cout << f[n][m] << endl;
return 0;