提交时间:2022-08-18 11:03:43
运行 ID: 55451
#include<bits/stdc++.h> #define mod 1000000007 #define ll long long inline int read(){ int x(0),f(1);char ch(getchar()); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48),ch=getchar();} return x*f; } int n,m,w,a[505];ll dp[505][75][455],ans; int main(){ // freopen("Homework.in","r",stdin); // freopen("Homework.out","w",stdout); n=read();m=read();w=read(); for(int i(1);i<=n;++i) a[i]=read(); for(int k(0);k<=w;++k) dp[0][0][k]=1; for(int i(1);i<=m;++i) for(int j(1);j<=n;++j) for(int k(0);k<=j;++k) for(int l(a[j]);l<=w;++l) (dp[i][j][l]+=dp[i-1][k][l-a[j]])%=mod; for(int j(1);j<=n;++j) (ans+=dp[m][j][w])%=mod; printf("%lld\n",ans); return 0; }