문제 : https://www.acmicpc.net/problem/2775
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int[][] room = new int[15][14];
for (int i = 1; i <= 14; i++) {
room[0][i - 1] = i;
room[i][0] = 1;
}
for (int i = 1; i < 15; i++) {
for (int j = 1; j < 14; j++) {
room[i][j] = room[i][j - 1] + room[i - 1][j];
}
}
Scanner scan = new Scanner(System.in);
int input = scan.nextInt();
int [] result = new int [input];
for( int i = 0 ; i < input ; i ++) {
int k = scan.nextInt();
int n = scan.nextInt();
result[i] = room[k][n-1];
}
for(int res : result) {
System.out.println(res);
}
}
}
'알고리즘 > 심심풀이 문제풀기' 카테고리의 다른 글
[심심풀이 백준문제풀기] 7576번 토마토 (0) | 2018.03.14 |
---|---|
[심심풀이 백준문제풀기] 1475번 방 번호 (0) | 2018.03.05 |
[심심풀이 백준문제풀기] 1924번 2007년 (0) | 2018.03.04 |
[심심풀이 백준문제풀기] 10250번 ACM 호텔 (0) | 2018.03.04 |
[심심풀이 백준문제풀기] 1011번 Fly me to the Alpha Centauri (0) | 2018.03.03 |