- 线性DP、背包
整好 神威 大道至简
- @ 2025-8-28 8:52:09
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int M=3e3+20;
int n,m;
LL dp[M];
int main()
{
cin>>n>>m;
dp[0]=1;
for(int i=1;i<=n;i++){
int x;
cin>>x;
for(int j=x;j<=m;j++) dp[j]=dp[j-x]+dp[j];
}
cout<<dp[m]<<endl;
return 0;
}
0 条评论
目前还没有评论...