题目大意:给两个数n, m,求C(n, m)。用java直接写就好了。
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
1 import java.io.*; 2 import java.util.*; 3 import java.math.*; 4 5 class Main 6 { 7 public static void main(String[] args) 8 { 9 Scanner sc = new Scanner(System.in); 10 BigInteger[] fact = new BigInteger[110]; 11 fact[0] = BigInteger.ONE; 12 for (int i = 1; i <= 100; i++) 13 fact[i] = fact[i-1].multiply(BigInteger.valueOf(i)); 14 int n, m; 15 while (sc.hasNext()) 16 { 17 n = sc.nextInt(); 18 m = sc.nextInt(); 19 if (n == 0 && m == 0) break; 20 BigInteger ans = fact[n].divide(fact[m]).divide(fact[n-m]); 21 System.out.println(n + " things taken " + m + " at a time is " + ans + " exactly."); 22 } 23 24 } 25 }