8000 Merge pull request #482 from paulcjy/master · hackerman91/basic-algo-lecture@6f64ef1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f64ef1

Browse files
Merge pull request encrypted-def#482 from paulcjy/master
Create 2448_1.cpp
2 parents 5b2480c + 5c7ef63 commit 6f64ef1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

0x0B/solutions/2448_1.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Authored by : paulcjy
2+
// Co-authored by : -
3+
// http://boj.kr/b510439ad07b43d2b6a689ff104c3783
4+
#include <bits/stdc++.h>
5+
using namespace std;
6+
7+
void print_star(int n, int i, int j) {
8+
if (j <= 2*i)
9+
if (n == 3 && !(i == 1 && j == 1)) cout << '*';
10+
else print_star(n/2, i%(n/2), j%n);
11+
else cout << ' ';
12+
}
13+
14+
int main() {
15+
ios::sync_with_stdio(0);
16+
cin.tie(0);
17+
int n;
18+
cin >> n;
19+
for (int i = 0; i < n; i++) {
20+
cout << string(n-i-1, ' ');
21+
for (int j = 0; j <= n+i; j++)
22+
print_star(n, i, j);
23+
cout << '\n';
24+
}
25+
}

0 commit comments

Comments
 (0)
0