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

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


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

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<vector>
 5 #include<cstdlib>
 6 #include<cmath>
 7 #include<cstring>
 8 using namespace std;
 9 #define maxn 10010
10 #define llg int
11 #define md 998244353 
12 #define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
13 llg n,m,ans,x,w;
14 
15 inline int getint()
16 {
17     int w=0;
18     char c=getchar();
19     while((c<'0' || c>'9') && c!='-') c=getchar();
20     //if (c=='-')  q=1, c=getchar();
21     while (c>='0' && c<='9') w=w*10+c-'0', c=getchar();
22     return w;
23 }
24 
25 int main()
26 {
27     yyj("a");
28     cin>>n;
29     for (register llg i=1;i<=n;i++)
30     {
31         x=getint();
32         w+=x;
33     }
34     ans=1;
35     for (register llg i=1;i<=w;i++)  if (i+n!=w+1) ans=1LL*ans*i%md;
36     cout<<ans;
37     return 0;
38 }

 

posted @ 2017-02-23 09:27  №〓→龙光←  阅读(485)  评论(2编辑  收藏  举报