From 47368f3cfca459ec6ad49efb6f5327bc3c7db7f3 Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 4 Feb 2025 16:30:57 +0900 Subject: [PATCH] =?UTF-8?q?[20250204]=20BOJ=20/=20=EC=8B=A4=EB=B2=842=20/?= =?UTF-8?q?=20=EB=B3=84=20=EC=B0=8D=EA=B8=B0=20-=2022=20/=20=EA=B6=8C?= =?UTF-8?q?=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\263\204 \354\260\215\352\270\260 - 22.md" | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 "khj20006/202502/04 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" diff --git "a/khj20006/202502/04 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" "b/khj20006/202502/04 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" new file mode 100644 index 00000000..323e4f0e --- /dev/null +++ "b/khj20006/202502/04 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" @@ -0,0 +1,63 @@ +```java + +import java.util.*; +import java.io.*; + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static long nextLong() {return Long.parseLong(st.nextToken());} + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + public static void main(String[] args) throws Exception { + + int N = Integer.parseInt(br.readLine()); + + if(N == 1) { + bw.write("*"); + bwEnd(); + return; + } + + char[][] ans = new char[4*N-1][4*N-3]; + for(int i=0;i<4*N-1;i++) Arrays.fill(ans[i], ' '); + + int a = 0, b = 4*N-4, c = 4*N-2; + while(a<=b) { + for(int i=a;i<=b;i++) { + ans[a][i] = '*'; + ans[c][i] = '*'; + } + for(int i=a;i<=c;i++) { + ans[i][a] = '*'; + ans[i][b] = '*'; + } + if(a != 0) ans[a][b+1] = '*'; + if(a != b) ans[a+1][b] = ' '; + a += 2; + b -= 2; + c -= 2; + } + + for(int i=0;i<4*N-1;i++) { + for(int j=0;j<4*N-3;j++) { + bw.write(ans[i][j]); + if(i == 1 && j == 0) break; + } + bw.write("\n"); + } + + bwEnd(); + } + +} + +```