链接:https://www.luogu.org/problemnew/show/P1641
仍然不会用卡特兰数.jpg,看了题解折线法推得很好,但自己这辈子都想不到的。。
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
const int mod=20100403;
const int N=2000000;
int jc[N+10],ijc[N+10];
int qpow(int x,int y)
{
int res=1;
while(y)
{
if(y&1)res=1LL*res*x%mod;
x=1LL*x*x%mod,y>>=1;
}
return res;
}
void init()
{
ijc[0]=jc[0]=1;
for(int i=1;i<=N;i++)
jc[i]=1LL*jc[i-1]*i%mod;
ijc[N]=qpow(jc[N],mod-2);
for(int i=N-1;i>=1;i--)
ijc[i]=1LL*ijc[i+1]*(i+1)%mod;
}
int C(int x,int y)
{return 1LL*jc[x]*ijc[y]%mod*ijc[x-y]%mod;}
int main()
{
int n,m;
init();
cin>>n>>m;
cout<<(C(n+m,m)-C(n+m,m-1)+mod)%mod;
}