标签:
2 3 2 2 3 2 1
2 1
#include<stdio.h>
#include<string.h>
#define mod 1000000007
__int64 s[2010][2010],c[2010][2010],n,f,b;
void fun()
{
int i,j;
for(i=0;i<2010;i++)
{
c[i][0]=1;
c[i][i]=1;
s[i][0]=0;
s[i][i]=1;
for(j=0;j<i;j++)
{
c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
s[i][j]=(s[i-1][j]*(i-1)%mod+s[i-1][j-1])%mod;
}
}
}
int main()
{
int t;
fun();
scanf("%d",&t);
while(t--)
{
scanf("%I64d%I64d%I64d",&n,&f,&b);
printf("%I64d\n",c[b+f-2][f-1]*s[n-1][f+b-2]%mod);
}
}
HDOJ 题目4372 Count the Buildings(斯特林第一类数)
标签:
原文地址:http://blog.csdn.net/yu_ch_sh/article/details/45080189