提交时间:2023-12-09 10:28:38

运行 ID: 114854

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