SOLUTION INFO
C++ · main.cpp
#include<bits/stdc++.h>
using namespace std;
char stars[3500][6500];
char DB[3][6] = {
" * ",
" * * ",
"*****"
};
void solve(int y, int x, int s) {
if(s == 1) {
for(int i=0;i<3;i++){
for(int j=0;j<5;j++){
stars[y + i][x + j] = DB[i][j];
}
}
return;
}
s /= 2;
solve(y, x + 3 * s, s);
solve(y + 3 * s, x, s);
solve(y + 3 * s, x + 6 * s, s);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
solve(0, 0, n / 3);
for(int i=0;i<n;i++){
for(int j=0;j<2*n-1;j++){
if(stars[i][j] == '*') cout << '*';
else cout << ' ';
}
cout << '\n';
}
return 0;
}
SOLUTION DESCRIPTION
풀이 설명
등록된 풀이 설명이 없습니다.