zoukankan      html  css  js  c++  java
  • SCP-bzoj-4734

    项目编号: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
    ",ans),0;
    59 }
    View Code
  • 相关阅读:
    最小树形图 朱刘算法模板+建边技巧
    模板倍增LCA 求树上两点距离 hdu2586
    【瞎搞题】gym226123 L. For the Honest Election
    【凸包板题】Gym
    集合3
    集合2
    集合1
    常用API&异常
    内部类&API
    多态&接口类&接口
  • 原文地址:https://www.cnblogs.com/spactim/p/7048695.html
Copyright © 2011-2022 走看看