提交时间:2022-08-18 10:58:25

运行 ID: 55415

#include<bits/stdc++.h> using namespace std; const int mod=1e9+7; int wr[505],n,m,k; long long ans; inline long long read(){ register long long x=0,f=0; register char t=getchar(); while(t<'0'||t>'9')f^=(t=='-'),t=getchar(); while(t>='0'&&t<='9')x=(x<<3)+(x<<1)+(t^48),t=getchar(); return f?-x:x; } void ch(int hw,int ws,int l){ if(hw==0&&ws>=0){ ans++; return ; } if(ws<=0) return ; for(int i=l;i<=n;i++){ ch(hw-1,ws-wr[i],i); } } int main(){ n=read(),m=read(),k=read(); for(int i=1;i<=n;i++) wr[i]=read(); ch(m,k,1); printf("%d\n",ans%mod); return 0; }