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(); + } + } +} + +```