-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2448.cpp
More file actions
62 lines (43 loc) · 1004 Bytes
/
2448.cpp
File metadata and controls
62 lines (43 loc) · 1004 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
50
51
52
53
54
55
56
57
58
59
60
61
62
#include<iostream>
#include<vector>
#include<algorithm>
typedef long long LL;
using namespace std;
char graph[10000][10000];
void drawBasicTrangle(int x, int y) {
graph[y][x] = '*';
graph[y + 1][x - 1] = '*';
graph[y + 1][x + 1] = '*';
graph[y + 2][x - 2] = '*';
graph[y + 2][x - 1] = '*';
graph[y + 2][x - 0] = '*';
graph[y + 2][x + 1] = '*';
graph[y + 2][x + 2] = '*';
}
void recursiveDraw(int x, int y, int size) {
if (size == 3) {
drawBasicTrangle(x, y);
return;
}
else {
size = size / 2;
recursiveDraw(x, y, size);
recursiveDraw(x - size, y + size, size);
recursiveDraw(x + size, y + size, size);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N;
cin >> N;
fill(&graph[0][0], &graph[9999][10000], ' ');
recursiveDraw(N - 1, 0, N);
for (int i = 0; i < N; i++) {
for (int j = 0; j <= 2 * N - 1; j++) {
cout << graph[i][j];
}
cout << '\n';
}
}