标签:
4 4
1 1 2 2
3
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<algorithm> using namespace std; int n,m,cnt,a[20005],f[20005]; int main(){ cin>>n>>m; for(int i = 1;i <= n;i++) scanf("%d",&a[i]); f[0] = 1; for(int i = 1;i <= n;i++){ for(int j = m;j >= a[i];j--){ f[j] += f[j - a[i]]; } } cout<<f[m]; return 0; }
标签:
原文地址:http://www.cnblogs.com/hyfer/p/5791399.html