Skip to content

Commit

Permalink
Merge pull request #27 from AlgoLeadMe/8-YIM2UL2ET
Browse files Browse the repository at this point in the history
8-YIM2UL2ET
  • Loading branch information
YIM2UL2ET authored Mar 10, 2024
2 parents 83e126e + 59c0e15 commit d9fc0fc
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions YIM2UL2ET/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
| 5μ°¨μ‹œ | 2024.02.24 | 큐 | [BOJ 1158](https://www.acmicpc.net/problem/1158) | [BOJ 1158 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/16) |
| 6μ°¨μ‹œ | 2024.02.27 | μ •λ ¬ | [BOJ 1599](https://www.acmicpc.net/problem/1599) | [BOJ 1599 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/21) |
| 7μ°¨μ‹œ | 2024.03.01 | μž¬κ·€ | [BOJ 2705](https://www.acmicpc.net/problem/2705) | [BOJ 2705 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/23) |
| 8μ°¨μ‹œ | 2024.03.01 | μž¬κ·€ | [BOJ 10994](https://www.acmicpc.net/problem/10994) | [BOJ 10994 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/27) |
---
42 changes: 42 additions & 0 deletions YIM2UL2ET/μž¬κ·€/8μ°¨μ‹œ - BOJ 10994.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <iostream>

void cover1(int n, int level)
{
for (int i = 0; i < level; i++) std::cout << "* ";
for (int i = 0; i < 4*(n-level)-3; i++) std::cout << "*";
for (int i = 0; i < level; i++) std::cout << " *";
std::cout << "\n";
}

void cover2(int n, int level)
{
for (int i = 0; i < level; i++) std::cout << "* ";
std::cout << "*";
for (int i = 0; i < 4*(n-level)-5; i++) std::cout << " ";
std::cout << "*";
for (int i = 0; i < level; i++) std::cout << " *";
std::cout << "\n";
}

void star(int n, int level)
{
if (n == level+1) {
for (int i = 0; i < n*2-2; i++) std::cout << "* ";
std::cout << "*\n";
}
else {
cover1(n, level);
cover2(n, level);
star(n, level+1);
cover2(n, level);
cover1(n, level);
}
}

int main(void)
{
int n;
std::cin >> n;
star(n, 0);
return 0;
}

0 comments on commit d9fc0fc

Please sign in to comment.