项目编号:bzoj-4734

项目等级:Safe

项目描述:

  戳这里

特殊收容措施:

附录:

 1 #include <bits/stdc++.h>
 2 #define range(i,c,o) for(register int i=(c);i<(o);++i)
 3 using namespace std;
 4 
 5 // quick_io BEGIN HERE
 6 #ifdef __WIN32
 7     #define getC getchar
 8 #else
 9     #define getC getchar_unlocked
10 #endif
11 
12 inline unsigned getU()
13 {
14     char c; unsigned r=0;
15     while(!isdigit(c=getC()));
16     for(;isdigit(c);c=getC())
17     {
18         r=(r<<3)+(r<<1)+c-'0';
19     }
20     return r;
21 }
22 // quick_io END HERE
23 
24 static const int AwD=998244353;
25 
26 inline int rev(const int&x)
27 {
28     int ret=1;
29     for(int i=AwD-2,j=x;i;i>>=1,j=1LL*j*j%AwD)
30     {
31         if(i&1) ret=1LL*ret*j%AwD;
32     }
33     return ret;
34 }
35 
36 int b[20005],f[20005];
37 
38 int main()
39 {
40     int N=getU(),M=getU(),x=getU();
41     range(i,0,M+1) f[i]=getU();
42     range(i,0,M+1)
43     {
44         b[i]=f[0];
45         range(j,0,M-i)
46         {
47             f[j]=f[j+1]-f[j];
48             if(f[j]<0) f[j]+=AwD;
49         }
50     }
51     int ans=b[0],C=1,X=1;
52     range(i,1,M+1)
53     {
54         C=1LL*C*(N-i+1)%AwD*rev(i)%AwD;
55         X=1LL*X*x%AwD;
56         ans=(ans+1LL*b[i]*C%AwD*X)%AwD;
57     }
58     return printf("%d\n",ans),0;
59 }
View Code