#include <iostream>
using namespace std;
bool check(int size, int i, int j)
{
if (size <= 0)
return false;
int _size = size;
int _y = i % _size;
int _x = j % _size;
int _left = (_size / 3) - 1;
int _right = (_left + 1) * 2;
if ((_left < _y && _y < _right) && (_left < _x && _x < _right))
{
return true;
}
else if (check(_size / 3, i, j))
return true;
return false;
}
int main()
{
int size = 0;
cin >> size;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (check(size, i, j))
cout << " ";
else
cout << "*";
}
cout << endl;
}
return 0;
}
LIST
'알고리즘 문제 > 백준' 카테고리의 다른 글
[c++] 덩치 - 7568 (0) | 2022.11.13 |
---|---|
[ C++ ] 단어 뒤집기 - 9093 (0) | 2022.11.12 |
입출력과 사칙연산 [2588 곱셈] C# (0) | 2022.05.04 |
입출력과 사칙연산 [10430 나머지] C# (0) | 2022.05.04 |
입출력과 사칙연산 [18108 내가 태국에서는 2541년생? ] C# (0) | 2022.05.04 |