具体b站
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int a[105];
int f[N];
int main()
{
int n,m;
cin>>n>>m;
f[0]=1;
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
for(int i=n;i>=1;i--)
{
for(int j=m;j>=a[i];j--)
{f[j]+=f[j-a[i]];}
// cout<<f[2]<<endl;
}
cout<<f[m]<<endl;
return 0;
}
京公网安备 11010502036488号