zoukankan      html  css  js  c++  java
  • bzoj1856 [SCOI2010]字符串

    题目链接

    题解:http://www.cnblogs.com/jianglangcaijin/p/3443689.html

    求逆元还是快速幂好用

     1 #include<algorithm>
     2 #include<iostream>
     3 #include<cstdlib>
     4 #include<cstring>
     5 #include<cstdio>
     6 #include<string>
     7 #include<cmath>
     8 #include<ctime>
     9 #include<queue>
    10 #include<stack>
    11 #include<map>
    12 #include<set>
    13 #define rre(i,r,l) for(int i=(r);i>=(l);i--)
    14 #define re(i,l,r) for(int i=(l);i<=(r);i++)
    15 #define Clear(a,b) memset(a,b,sizeof(a))
    16 #define inout(x) printf("%d",(x))
    17 #define douin(x) scanf("%lf",&x)
    18 #define strin(x) scanf("%s",(x))
    19 #define LLin(x) scanf("%lld",&x)
    20 #define op operator
    21 #define CSC main
    22 typedef unsigned long long ULL;
    23 typedef const int cint;
    24 typedef long long LL;
    25 using namespace std;
    26 void inin(int &ret)
    27 {
    28     ret=0;int f=0;char ch=getchar();
    29     while(ch<'0'||ch>'9'){if(ch=='-')f=1;ch=getchar();}
    30     while(ch>='0'&&ch<='9')ret*=10,ret+=ch-'0',ch=getchar();
    31     ret=f?-ret:ret;
    32 }
    33 int n,m;
    34 const LL mod=20100403;
    35 LL inv(LL a,LL n)
    36 {
    37     a%=n;
    38     LL b=n-2,ret=1;
    39     while(b)
    40     {
    41         if(b&1)ret=ret*a%n;
    42         b>>=1;
    43         a=a*a%n;
    44     }
    45     return ret;
    46 }
    47 LL C(int a,int b)
    48 {
    49     LL x=a;
    50     re(i,2,b)x=x*(a-i+1)%mod*inv(i,mod)%mod;
    51     return x;
    52 }
    53 int CSC()
    54 {
    55     inin(n),inin(m);
    56     printf("%lld",((C(n+m,n)-C(n+m,m-1))%mod+mod)%mod);
    57     return 0;
    58 }
  • 相关阅读:
    netty ByteToMessageDecoder 分析
    netty 编/解码处理
    MAC 入门
    netty 学习
    php ioc and web rest design
    spring 启动流程
    淘宝美衣人
    ecslipe cdt lib link
    阿里巴巴中间件团队招人了!
    架构师速成-架构目标之伸缩性安全性
  • 原文地址:https://www.cnblogs.com/HugeGun/p/5199725.html
Copyright © 2011-2022 走看看