SDUT2241计算组合数C(n,m)(组合数)

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

这个题的代码适应性也挺强,但这个题倒不适应太多代码,不知道为什么总会出现越界

 1 #include<stdio.h>
 2 
 3 int main ()
 4 {
 5     int a,m,n;
 6     double sum;
 7     scanf("%d",&a);
 8     for(int i = 1 ; i<= a ;i++)
 9     {
10         scanf("%d %d",&m,&n);
11         sum=1;
12         while(n>0)
13         {
14             sum=sum*((m*1.0)/n);
15              m--;
16               n--;
17         }
18         printf("%.0lf
",sum);
19     }
20     return 0;
21 }
View Code
原文地址:https://www.cnblogs.com/luyingfeng/p/3272837.html