-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_2775.java
More file actions
36 lines (29 loc) ยท 1014 Bytes
/
_2775.java
File metadata and controls
36 lines (29 loc) ยท 1014 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package backjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
// https://www.acmicpc.net/problem/2775
// ๋ถ๋
ํ์ฅ์ด ๋ ํ
์ผ
public class _2775 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// memory 11412 runtime 84
int leng = Integer.parseInt(br.readLine());
// 15์ธต ์ํํธ ์์ฑ
int[][] APT = new int[15][15];
for(int i = 0; i < 15; i++) {
APT[i][1] = 1; // i์ธต 1ํธ๋ ํญ์ 1๋ช
APT[0][i] = i; // 0์ธต 1๋ช
์ฉ ์ฆ๊ฐํ๋ ๋์ ํฉ
}
for(int i = 1; i < 15; i ++) { // ์ธต๋ณ
for(int j = 2; j < 15; j++) { // ํธ๋ณ -> 1ํธ๋ ํญ์ 1๋ช
์ด๋๊น 2ํธ๋ถํฐ
APT[i][j] = APT[i][j - 1] + APT[i - 1][j];
}
}
for(int i=0; i<leng; i++){
int k = Integer.parseInt(br.readLine());
int n = Integer.parseInt(br.readLine());
System.out.println(APT[k][n]);
}
}
}