Binomial Coeffcients 历届山东省省赛题

时间:2023-12-26 15:43:31

Binomial Coeffcients

Time Limit: 1000MS Memory limit: 65536K

题目描述

 Binomial Coeffcients 历届山东省省赛题

输入

 Binomial Coeffcients 历届山东省省赛题

输出

Binomial Coeffcients 历届山东省省赛题 

示例输入

3
1 1
10 2
954 723

示例输出

1
45
3557658
 
#include<iostream>
using namespace std;
#include <string.h> int a[1020][1020];
int main()
{
int n,m,i,j,k;
memset(a,0,sizeof(a));
a[0][0]=1;
for(i=1; i<=1000; i++)
{
a[i][0]=1;
for(j=1; j<=i; j++)
{
a[i][j]=a[i-1][j]+a[i-1][j-1];
if(a[i][j]>10000003)
a[i][j]=a[i][j]-10000003;
}
}
cin>>k;
while(k--)
{
cin>>n>>m;
cout<<a[n][m]<<endl;
}
return 0;
}