<aside> 💛

1010번

</aside>

N ≤ M에서 최대한 많은 다리를 놓기 위해서는 N개의 다리가 필요하고 M개에서 다리를 놓을 포인트를 정해야 한다.

→ M개에서 N개를 선택, 중복 x

import java.util.Scanner;
public class Practice79 {
	static long[][] D;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		D = new long[31][31];
		
		for(int i = 0;i <= 30; i++) {
			D[i][1] = i;
			D[i][0] = 1;
			D[i][i] = 1;
		}
		for(int i = 2; i <= 30; i++) {
			for(int j = 1; j <= i; j++) {
				D[i][j] = D[i - 1][j] + D[i - 1][j - 1];
			}
		}
		
		int t = sc.nextInt();
		for(int i = 0;i < t; i++) {
			int N = sc.nextInt();
			int M = sc.nextInt();
			System.out.println(D[M][N]);
		}		
		
		sc.close();
	}
}