题解:求装满背包方案数
#include <iostream>
using namespace std;
int w[10005];
long long f[10005];
int main()
{
int n,m;
f[0]=1;
cin>>n>>m;
for(int i=1;i<=n;i++)
cin>>w[i];
for(int i=1;i<=n;i++)
for(int v=w[i];v<=m;v++)
f[v]=f[v]+f[v-w[i]];
cout<<f[m];
}