hdu 2519 新生晚会 排列组合

通过阶段性计算减少一次性的大值计算

#include <stdio.h>
int main()
{
    int t, a, b, i;
    __int64 c;
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d%d", &a, &b);
        if(a < b)
            printf("0
");
        else
        {
            c = 1;
            for(i = 1; i <= b; i++)
                c = c * (a - i + 1) / i;
            printf("%I64d
", c);
        }
    }
    return 0;
}
原文地址:https://www.cnblogs.com/woshijishu3/p/4098585.html