思路:组合数+隔板法,除了分割W和B的那两块板,还有N-3块板插进去。
# include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 8e3;
const LL mod = 1e9+9;
LL inv[maxn+3] = {1,1}, fac[maxn+3] = {1,1}, fi[maxn+3] = {1,1};
void init()
{
for(int i=2; i<=maxn; ++i)
{
fac[i] = fac[i-1]*i%mod;
inv[i] = (mod-mod/i)*inv[mod%i]%mod;
fi[i] = fi[i-1]*inv[i]%mod;
}
}
LL c(LL n, LL m)
{
return fac[n]*fi[n-m]%mod*fi[m]%mod;
}
int main()
{
init();
LL n, w, b, ans = 0;
scanf("%I64d%I64d%I64d",&n,&w,&b);
for(LL i=1; i<w; ++i)
{
ans += c(w,i)*fac[i]%mod*fac[b]%mod*fac[w-i]%mod*c(w+b-3,n-3)%mod;
ans %= mod;
}
printf("%I64d\n",ans);
return 0;
}