File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,3 +132,4 @@ hs_err_pid*
132132
133133# custom
134134/src /scofe2021 /
135+ /src /kakao2021 /
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments