提交时间:2023-12-09 10:13:22
运行 ID: 114832
#include<bits/stdc++.h> #define int unsigned long long using namespace std; int a[1000005],dp[1000005] = {1}; signed main(){ int n,w; cin>>n>>w; for (int i = 1;i <= n;i++){ cin>>a[i]; } for (int i = 1;i <= n;i++){ for (int j = a[i];j <= w;j++){ dp[j] += dp[j - a[i]]; } } cout<<dp[w]; return 0; }