提交时间:2022-08-18 10:58:54
运行 ID: 55418
#include <bits/stdc++.h> using namespace std; #define ll long long const int N =510; const int mod=1e9+7; ll dp[N][N]; ll a[N]; int main() { //freopen("text9.in","r",stdin); //freopen("text9.out","w",stdout); int n,m,b; cin>>n>>m>>b; for(int i=1;i<=n;i++) cin>>a[i]; dp[0][0]=1; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) for(int k=a[i];k<=b;k++) dp[j][k]=(dp[j][k]+dp[j-1][k-a[i]])%mod; int ans=0; for(int i=1;i<=b;i++) ans=(ans+dp[m][i])%mod; cout<<ans<<endl; }