-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #482 from paulcjy/master
Create 2448_1.cpp
- Loading branch information
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} |