728x90
반응형
2024.07.07기준 - 브론즈 3
백준, BEAKJOON, BOJ, JAVA, 자바
풀이
이 문제는 단순 출력 문제입니다.
저의 접근은 부분 부분을 나눠 조합하는 방식으로 선택했습니다.
- G..부분을 나눠 k의 개수만큼 출력합니다.
- .I.T 부분을 k만큼 출력합니다.
- ..S. 부분을 k만큼 출력합니다.
코드
package Main;
import java.io.*;
import java.util.*;
public class Main {
static int n;
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
n = Integer.parseInt(br.readLine()); // 정수
for (int i = 0; i < n; i++) {
one();
}
for (int i = 0; i < n; i++) {
two();
}
for (int i = 0; i < n; i++) {
three();
}
bw.write(sb.toString());
bw.flush();
bw.close();
br.close();
}
private static void one() {
for (int i = 0; i < n; i++) {
sb.append("G");
}
for (int i = 0; i < n; i++) {
sb.append("...");
}
sb.append("\n");
}
private static void two() {
for (int i = 0; i < n; i++) {
sb.append(".");
}
for (int i = 0; i < n; i++) {
sb.append("I");
}
for (int i = 0; i < n; i++) {
sb.append(".");
}
for (int i = 0; i < n; i++) {
sb.append("T");
}
sb.append("\n");
}
private static void three() {
for (int i = 0; i < n; i++) {
sb.append("..");
}
for (int i = 0; i < n; i++) {
sb.append("S");
}
for (int i = 0; i < n; i++) {
sb.append(".");
}
sb.append("\n");
}
}
728x90
반응형
'코딩테스트 일기 (BAEKJOON)' 카테고리의 다른 글
BAEKJOON / 백준 - JAVA 28453번 Previous Level (0) | 2024.07.08 |
---|---|
BEAKJOON / 백준 - JAVA 1992번 쿼드트리 (0) | 2024.07.07 |
BAEKJOON / 백준 - JAVA 31880번 K512컵 개최! (0) | 2024.07.06 |
BEAKJOON / 백준 - JAVA 27112번 시간 외 근무 멈춰! (0) | 2024.07.06 |
BEAKJOON / 백준 - JAVA 25327번 다중 항목 선호도 조사 (Large) (0) | 2024.07.05 |