zoukankan      html  css  js  c++  java
  • Educational Codeforces Round 52 (Rated for Div. 2) E. Side Transmutations

    http://codeforces.com/contest/1065/problem/E

    数学推导题

     1 #include <bits/stdc++.h>
     2 using namespace std;
     3 #define ll long long
     4 #define minv 1e-6
     5 #define inf 1e9
     6 #define pi 3.1415926536
     7 #define nl 2.7182818284
     8 const ll mod=998244353;
     9 const int maxn=1e5+10;
    10 
    11 ll mul(ll a,ll b)
    12 {
    13     ll y=1;
    14     while (b)
    15     {
    16         if (b & 1)
    17             y=y*a%mod;
    18         b>>=1;
    19         a=a*a%mod;
    20     }
    21     return y;
    22 }
    23 
    24 int main()
    25 {
    26     int n,m,g,b,preb,len,i;
    27     ll sum=1,v;
    28     scanf("%d%d%d",&n,&m,&g);
    29     preb=0;
    30     for (i=1;i<=m;i++)
    31     {
    32         scanf("%d",&b);
    33         len=b-preb;
    34         v=mul(g,len);
    35         sum=(sum*v%mod*(v+1)%mod*499122177)%mod;
    36         preb=b;
    37     }
    38     v=mul(g,n-2*b);
    39     sum=sum*v%mod;
    40     cout<<sum;
    41     return 0;
    42 }
  • 相关阅读:
    Django中的分页操作、form校验工具
    Django之form表单操作
    手写版本orm
    mysql注入问题
    MySQL基本操作
    初识数据库
    进程池、线程池
    信号量
    event事件
    死锁
  • 原文地址:https://www.cnblogs.com/cmyg/p/9838520.html
Copyright © 2011-2022 走看看