SDUT1574组合数的计算(组合数)

http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1574

这个题,比较奇怪,是用递推去做的,我试了很多计算组合数的代码交到这个题上都是WA

这个是AC代码

#include<stdio.h>
long long ch[141][141];
int main()
{
    for(int i = 0; i < 141; i++)
    {
        ch[i][i] = ch[i][0] = 1;
    }
    for(int i = 1; i < 141; i++)
    {
        for(int j = 1; j < i; j++)
        {
            ch[i][j] = ch[i-1][j-1] + ch[i-1][j];
        }
    }
    int n,m,k;
    scanf("%d
",&k);
    for(int i = 1 ; i <= k ; i++)
    {
        scanf("%d %d",&m,&n);
        printf("%lld
",ch[m][n]);
    }
}
View Code
原文地址:https://www.cnblogs.com/luyingfeng/p/3272846.html