From c4c3a1e5582cfba22fdfe549ebccf214ce0e5e52 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Thu, 6 Feb 2025 17:21:14 +0900 Subject: [PATCH] =?UTF-8?q?[20250206]=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=B9=80?= =?UTF-8?q?=EC=88=98=EC=97=B0?= 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" | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 "suyeun84/202502/06 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" diff --git "a/suyeun84/202502/06 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" "b/suyeun84/202502/06 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" new file mode 100644 index 00000000..bce7f142 --- /dev/null +++ "b/suyeun84/202502/06 BOJ S2 \353\263\204 \354\260\215\352\270\260 - 22.md" @@ -0,0 +1,50 @@ +```java +import java.util.*; +import java.io.*; + +class Solution +{ + public static void main(String[] args) throws Exception{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + int N = Integer.parseInt(st.nextToken()); + if (N == 1) { + System.out.println('*'); + return; + } + int row = 4*N-1; + int col = 4*N-3; + char[][] board = new char[row][col]; + for (int i = 0; i < row; i++) { + Arrays.fill(board[i], ' '); + } + int cnt = 0; + for (int c = 0; c < N; c++) { + for (int i = cnt; i < row-cnt; i++) { + board[i][cnt] = '*'; + board[i][col-cnt-1] = '*'; + } + for (int j = cnt; j < col-cnt; j++) { + board[cnt][j] = '*'; + board[row-cnt-1][j] = '*'; + } + cnt += 2; + } + + for (int i = 1; i < col/2+1; i++) { + if (i % 2 == 0) board[i][col-i] = '*'; + else board[i][col-i] = ' '; + } + + for (int i = 0; i < row; i++) { + for (int j = 0; j < col; j++) { + if(i == 1 && j > 0) continue; + System.out.print(board[i][j]); + } + System.out.println(); + } + } +} + +```