【UOJ】#273. 【清华集训2016】你的生命已如风中残烛

时间:2023-03-10 06:14:42
【UOJ】#273. 【清华集训2016】你的生命已如风中残烛

题目链接:http://uoj.ac/problem/273


$${Ans=\frac{\prod _{i=1}^{m}i}{w-n+1}}$$

 #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
#define maxn 10010
#define llg int
#define md 998244353
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg n,m,ans,x,w; inline int getint()
{
int w=;
char c=getchar();
while((c<'' || c>'') && c!='-') c=getchar();
//if (c=='-') q=1, c=getchar();
while (c>='' && c<='') w=w*+c-'', c=getchar();
return w;
} int main()
{
yyj("a");
cin>>n;
for (register llg i=;i<=n;i++)
{
x=getint();
w+=x;
}
ans=;
for (register llg i=;i<=w;i++) if (i+n!=w+) ans=1LL*ans*i%md;
cout<<ans;
return ;
}