andy6804tw
8/6/2016 - 7:52 AM

http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=23224

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		while (n-- != 0) {
			int N=scn.nextInt(),k=scn.nextInt();
			System.out.println(call(N)/(call(k)*call(N-k)));
		}
	}
	public static long call(int num){
		long tot=1;
		for(int i=1;i<=num;i++){
			tot*=i;
		}
		return tot;
	}
	

/* 
    題目:2014 闖關組 [Problem B2-易] Computing C(n,k)
    作者:1010
    時間:西元 2016 年 8 月 */
}