我永远讨厌(dp.jpg)
前置姿势
扩展(Min-Max)容斥
题解
看纳尔博客去→_→
咱现在还没搞懂为啥初值要设为(-1)……
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=a,I=b+1;i<I;++i)
#define fd(i,a,b) for(R int i=a,I=b-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
R int res,f=1;R char ch;
while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
return res*f;
}
const int N=10005,P=998244353;
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int inv[N],f[11][N];
int n,m,s,x,res;
int main(){
// freopen("testdata.in","r",stdin);
n=read(),s=n+1-read(),m=read();
inv[0]=inv[1]=1;fp(i,2,m)inv[i]=1ll*inv[P%i]*(P-P/i)%P;
fp(i,1,s)f[i][0]=-1;
fp(i,1,n){
x=read();
fd(j,m,x)fd(k,s,1)f[k][j]=add(f[k][j],dec(f[k-1][j-x],f[k][j-x]));
}
fp(i,1,m)res=add(res,mul(f[s][i],inv[i]));
printf("%d
",mul(res,m));
return 0;
}