提交时间:2024-01-03 13:11:57
运行 ID: 119001
#include<bits/stdc++.h> using namespace std; #define ll long long const int N=510,mod=1e9+7; ll dp[N][N],a[N]; int main() { 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; return 0; }