标签:source scanf nat str tracking printf 运算 center std
2 1 3 2 3
3 3
#include<stdio.h>
int c[2020][2020];//下面凝视以从n个球里面取m个球为例
void f()
{
int i,j;
for(i=1;i<2020;i++)//初始化,将全部的取 1个球的可能性复制为i%1007(这是题目中的要求)
{
c[i][1]=i%1007;
c[i][0]=1;//不取。可能为一
}
for(i=2;i<2020;i++)//排列组合公式
{
for(j=1;j<2020;j++)
{
c[i][j]=(c[i-1][j]+c[i-1][j-1])%1007;
}
}
}
int main()
{
int t,n,m;
f();
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&m,&n);
printf("%d\n",c[n][m]);
}
return 0;
} 标签:source scanf nat str tracking printf 运算 center std
原文地址:http://www.cnblogs.com/liguangsunls/p/7224485.html