提交时间:2023-12-09 08:50:27

运行 ID: 114744

#include<bits/stdc++.h> #define int unsigned long long using namespace std; int a[114514],dp[114514] = {1}; signed main(){ int v,n; cin>>v>>n; for (int i = 1;i <= v;i++){ cin>>a[i]; } for (int i = 1;i <= v;i++){ for (int j = a[i];j <= n;j++){ dp[j] += dp[j - a[i]]; } } cout<<dp[n]<<endl; return 0; }