We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 05f608d commit 8c7fc95Copy full SHA for 8c7fc95
1 file changed
live7/test74/문제1/이지은.js
@@ -0,0 +1,28 @@
1
+const input = require('fs')
2
+ .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3
+ .toString()
4
+ .trim();
5
+
6
+function solution(input) {
7
+ let size = input * 4 - 3;
8
+ let arr = Array.from({ length: size }, () => Array(size).fill(' '));
9
10
+ function star(x, y, size) {
11
+ if (size === 1) {
12
+ arr[x][y] = '*';
13
+ return;
14
+ }
15
16
+ for (let i = 0; i < size; i++) {
17
+ arr[x][y + i] = '*';
18
+ arr[x + i][y] = '*';
19
+ arr[x + size - 1][y + i] = '*';
20
+ arr[x + i][y + size - 1] = '*';
21
22
+ star(x + 2, y + 2, size - 4);
23
24
+ star(0, 0, size);
25
+ return arr.map((row) => row.join('')).join('\n');
26
+}
27
28
+console.log(solution(input));
0 commit comments