1100: 求组合数(函数专题)

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int m=cin.nextInt();
        int k=cin.nextInt();
        int result=fact(m)/(fact(k)*fact(m-k));
        System.out.println(result);
    }
    public static int fact(int n)
    {
        int ans=1;
        for(int i=2;i<=n;i++) ans*=i;
        return ans;
    }
}