您的位置:首页 > 其它

山东省第二届ACM大学生程序设计竞赛:Binomial Coeffcients

2016-04-09 10:41 459 查看

<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: rgb(255, 255, 255);">
</span>
<span style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: rgb(255, 255, 255);">题目描述</span>



输入



输出



示例输入

3
1 1
10 2
954 723


示例输出

1
45
3557658


提示

来源

山东省第二届ACM大学生程序设计竞赛
</pre><pre code_snippet_id="1639919" snippet_file_name="blog_20160409_3_8620377" name="code" class="cpp">
#include <iostream>
#include <cstring>
#include <string>
#include <stdio.h>
using namespace std;
int c[1002][1002];
void get()
{
memset(c,0,sizeof(c));
c[0][0]=c[1][0]=c[1][1]=1;
for(int i=2;i<1002;i++)
{
c[i][i]=c[i][0]=1;
for(int j=0;j<i;j++)
{
c[i][j]=(c[i-1][j-1]+c[i-1][j])%10000003;
}
}
}
int main()
{
get();
int n;
cin>>n;
while(n--)
{
int a,b;
cin>>a>>b;
cout<<c[a][b]<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: