题不难,可我答的不够好。

  T1时间太长,忘了公式又推了半天。边码对拍边试公式,大概开考40分钟才A掉。

  T2想的太少,还是思路差一点拔高,大众分都能想到,应该能顺着想出来线段树思路。

  T3。。。。。因为给的时间过少,set建边不会,摸索半天,大概30分钟才把边建出来,然后打的时候发现我的dfs思路死了就剩10min了,立马想到他tarjan+topu,然后10分钟码完了撞了一个变量名,爆0了。

  这次考试大概比较简单,但是问题有

1.线段树的运用不够灵活,一般是能够化出来一个式子,把和变量有关的放到一块,扔到树上,然后用常量进行判断修改查询等。

2.T3有向图无向图搞混,这是不应该的,在确定要用图论来做的时候,先判断用哪部分知识。

  T1:裸catalan,没了。

#include<iostream>
#include<cstdio>
using namespace std;
const int N=2000020,mod=20100403;
int fac[N],inv[N];
inline int rd()
{
    int s=0,w=1;
    char cc=getchar();
    for(;cc<'0'||cc>'9';cc=getchar()) if(cc=='-') w=-1;
    for(;cc>='0'&&cc<='9';cc=getchar()) s=(s<<3)+(s<<1)+cc-'0';
    return s*w;
}
int qpow(int a,int k)
{
    int ans=1;
    for(;k;k>>=1,a=1ll*a*a%mod) if(k&1) ans=1ll*ans*a%mod;
    return ans;
}
int C(int n,int m)
{
    if(n<m) return 0;
    return 1ll*fac[n]*inv[n-m]%mod*inv[m]%mod;
}
int main()
{
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
    int n=rd(),m=rd();fac[0]=1;
    if(n<m) return puts("0"),0;
    for(int i=1;i<=n+m;i++) fac[i]=1ll*fac[i-1]*i%mod;
    inv[n+m]=qpow(fac[n+m],mod-2);
    for(int i=n+m;i>=1;i--) inv[i-1]=1ll*inv[i]*i%mod;
    printf("%d\n",(C(n+m,n)-C(n+m,m-1)+mod)%mod);
}
/*
g++ 1.cpp -o 1
./1
4 3
*/
View Code

相关文章: