Skip to content

Commit

Permalink
Merge pull request #482 from paulcjy/master
Browse files Browse the repository at this point in the history
Create 2448_1.cpp
  • Loading branch information
encrypted-def authored Mar 30, 2024
2 parents 5b2480c + 5c7ef63 commit 6f64ef1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 0x0B/solutions/2448_1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Authored by : paulcjy
// Co-authored by : -
// http://boj.kr/b510439ad07b43d2b6a689ff104c3783
#include <bits/stdc++.h>
using namespace std;

void print_star(int n, int i, int j) {
if (j <= 2*i)
if (n == 3 && !(i == 1 && j == 1)) cout << '*';
else print_star(n/2, i%(n/2), j%n);
else cout << ' ';
}

int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cout << string(n-i-1, ' ');
for (int j = 0; j <= n+i; j++)
print_star(n, i, j);
cout << '\n';
}
}

0 comments on commit 6f64ef1

Please sign in to comment.