본문 바로가기
Java/알고리즘

[Java] 백준 2775번 : 부녀회장이 될테야

by EricJeong 2019. 8. 21.

 

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int T = in.nextInt();

		int[][] apart = new int[15][14];
		for (int i = 0; i < 14; i++) {
			apart[0][i] = i + 1;
		}
		for (int i = 1; i <= 14; i++) {
			for (int j = 0; j < 14; j++) {
				for (int q = 0; q <= j; q++) {
					apart[i][j] += apart[i - 1][q];
				}
			}
		}
		for (int i = 0; i < T; i++) {
			int k = in.nextInt();
			int n = in.nextInt();

			System.out.println(apart[k][n - 1]);

		}
	}
}

 

 

 

댓글