File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # [ Bronze IV] 베라의 패션 - 15439
2+
3+ [ 문제 링크] ( https://www.acmicpc.net/problem/15439 )
4+
5+ ### 성능 요약
6+
7+ 메모리: 14236 KB, 시간: 108 ms
8+
9+ ### 분류
10+
11+ 구현, 조합론, 수학
12+
13+ ### 제출 일자
14+
15+ 2025년 7월 27일 16:22:48
16+
17+ ### 문제 설명
18+
19+ <p >베라는 상의 N 벌과 하의 N 벌이 있다. i 번째 상의와 i 번째 하의는 모두 색상 i를 가진다. N 개의 색상은 모두 서로 다르다.</p >
20+
21+ <p >상의와 하의가 서로 다른 색상인 조합은 총 몇 가지일까?</p >
22+
23+ ### 입력
24+
25+ <p >입력은 아래와 같이 주어진다.</p >
26+
27+ <pre >N</pre >
28+
29+ ### 출력
30+
31+ <p >상의와 하의가 서로 다른 색상인 조합의 가짓수를 출력한다.</p >
32+
Original file line number Diff line number Diff line change 1+ import java .io .*;
2+ public class Main {
3+
4+ static int n , ans ;
5+ static BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
6+ public static void main (String [] args ) throws Exception {
7+ n = Integer .parseInt (br .readLine ());
8+
9+ combi (0 , 0 );
10+ System .out .println (ans * 2 );
11+ }
12+
13+ static void combi (int cnt , int start ){
14+ if (cnt == 2 ){
15+ ans ++;
16+ return ;
17+ }
18+
19+ for (int i = start ; i < n ; i ++){
20+ combi (cnt + 1 , i + 1 );
21+ }
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments