Skip to content

Commit a89f7c6

Browse files
committed
issue #35 백준 2775 부녀회장이될테야 자바
1 parent 6ffd587 commit a89f7c6

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,4 @@ hs_err_pid*
132132

133133
# custom
134134
/src/scofe2021/
135+
/src/kakao2021/

src/backjoon/_2775.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package backjoon;
2+
3+
import java.io.BufferedReader;
4+
import java.io.IOException;
5+
import java.io.InputStreamReader;
6+
7+
// https://www.acmicpc.net/problem/2775
8+
// 부녀회장이 될테야
9+
public class _2775 {
10+
11+
public static void main(String[] args) throws IOException {
12+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
13+
// memory 11412 runtime 84
14+
int leng = Integer.parseInt(br.readLine());
15+
16+
// 15층 아파트 생성
17+
int[][] APT = new int[15][15];
18+
19+
for(int i = 0; i < 15; i++) {
20+
APT[i][1] = 1; // i층 1호는 항상 1명
21+
APT[0][i] = i; // 0층 1명씩 증가하는 누적합
22+
}
23+
24+
for(int i = 1; i < 15; i ++) { // 층별
25+
for(int j = 2; j < 15; j++) { // 호별 -> 1호는 항상 1명이니까 2호부터
26+
APT[i][j] = APT[i][j - 1] + APT[i - 1][j];
27+
}
28+
}
29+
30+
for(int i=0; i<leng; i++){
31+
int k = Integer.parseInt(br.readLine());
32+
int n = Integer.parseInt(br.readLine());
33+
System.out.println(APT[k][n]);
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)