-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16505.cpp
More file actions
49 lines (41 loc) · 693 Bytes
/
16505.cpp
File metadata and controls
49 lines (41 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// 16505. 별
// 2021.11.14
// 별 찍기
#include<iostream>
#include<cmath>
using namespace std;
char board[2001][2001];
void go(int n, int x, int y)
{
if (n == 1)
{
board[x][y] = '*';
return;
}
go(n / 2, x, y);
go(n / 2, x + n / 2, y);
go(n / 2, x, y + n / 2);
}
int main()
{
int n;
cin >> n;
n = pow(2, n);
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n; ++j)
{
board[i][j] = ' ';
}
}
go(n, 0, 0);
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < n - i; ++j)
{
cout << board[i][j];
}
cout << endl;
}
return 0;
}