05-21 07:17
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Mac
- X.org
- OOP
- Operator
- python
- dbms
- 리눅스 마스터 1급
- preprocessing
- Physical Scheme
- literal
- 셀레니움
- X윈도우
- 리눅스
- 백준
- Binary Search
- Inheritance
- Java
- Polymolphism
- systemd
- spring
- External Scheme
- descriptive statistics
- Class
- Entity Set
- BFS
- Reference Type
- 자바
- Unity
- Entity
- selenium
Archives
- Today
- Total
Byeol Lo
N4779 - 칸토어 집합 본문
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.BufferedWriter;
public class Main {
private static final BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));
private static final BufferedWriter BW = new BufferedWriter(new OutputStreamWriter(System.out));
private static final StringBuffer SB = new StringBuffer("");
public static void main(String[] args) throws IOException {
input();
BW.write(SB.toString());
BR.close();
BW.close();
}
private static void input() throws IOException {
String i = "";
while((i = BR.readLine()) != null)
SB.append(solution(Integer.parseInt(i))).append("\n");
}
private static String solution(int n) {
if(n==0) return "-";
else if(n==1) return "- -";
else {
int tmp = (int) Math.pow(3, n-1);
return solution(n-1) + " ".repeat(tmp) + solution(n-1);
}
}
}
'Algorithm > DevideConquer & Recursion' 카테고리의 다른 글
N11729 - 하노이 탑 이동 순서 (0) | 2023.12.11 |
---|---|
N2447 - 별 찍기 - 10 (0) | 2023.12.11 |
Comments