#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
#define ll long long 

int t,n,a[25],dp[1050];

int main(){
    scanf("%d%d",&n,&t);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    memset(dp,0,sizeof dp);
    dp[0]=1;//初始条件
    for(int i=1;i<=n;i++)
        for(int j=t;j>=a[i];j--)
            dp[j]+=dp[j-a[i]];
    printf("%d\n",dp[t]); 
}

 

相关文章:

  • 2022-12-23
  • 2021-06-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
相关资源
相似解决方案