You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

2 years ago
#include <bits/stdc++.h>
using namespace std;
const int N = 2000; // 竞赛的内存空间一般不做严格限制,所以,能开大一点就开大一点
char a[N][N]; // 结果数组,一个立方体是7列上下是6行,约7*50
char b[10][10] = {
" +---+", // b[0][2],5个字符
" / /|", // b[1][1],6个字符
"+---+ |", // b[2][0],7个字符
"| | +", // b[3][0],7个字符
"| |/ ", // b[4][0],6个字符
"+---+ " // b[5][0],5个字符
};
// 画出左右两个格子
void draw(int i, int j) {
memcpy(&a[i - 0][j], &b[5][0], 5); // 以(i,j)为左下角坐标进行,对于b[][]是从左下角开始粘贴
memcpy(&a[i - 1][j], &b[4][0], 6);
memcpy(&a[i - 2][j], &b[3][0], 7);
memcpy(&a[i - 3][j], &b[2][0], 7);
memcpy(&a[i - 4][j + 1], &b[1][1], 6);
memcpy(&a[i - 5][j + 2], &b[0][2], 5);
}
void print(int x, int y) {
for (int i = x - 20; i <= x + 20; i++) {
for (int j = y - 20; j <= y + 20; j++) {
if (a[i][j] == 0)
cout << '.';
else
cout << a[i][j];
}
cout << endl;
}
cout << endl;
}
int main() {
int x = 1000, y = 1000; // 三维坐标系原点坐标
// 画一个
draw(x, y);
print(x, y);
draw(x - 3, y);
print(x, y);
draw(x - 3 - 3, y);
print(x, y);
return 0;
}