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
| #include <bits/stdc++.h>
using namespace std;
char table[1024][2048];
void init() { for (int i = 0; i < 1024; ++i) for (int j = 0; j < 2048; ++j) table[i][j] = ' '; table[1023][0] = '/', table[1023][1] = table[1023][2] = '_', table[1023][3] = '\\'; table[1022][1] = '/', table[1022][2] = '\\'; }
void print(int width, int height) { for (int i = 1024 - height; i < 1024; ++i) { for (int j = 0; j < width; ++j) { cout << table[i][j]; } cout << endl; } }
int main() { int n, cnt = 2; cin >> n; init(); int width = 4, height = width >> 1; while (cnt <= n) { for (int i = 1024 - height; i < 1024; ++i) { for (int j = 0; j < width; ++j) { table[i][j + width] = table[i][j]; table[i - height][j + height] = table[i][j]; } } ++cnt, width *= 2, height *= 2; } print(width, height); return 0; }
|