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.

42 lines
1.2 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);
}
int main() {
int x = 1000, y = 1000; // 三维坐标系原点坐标
draw(x, y);
// 打印出来看看
for (int i = x - 5; i <= x; i++) {
for (int j = y; j <= y + 6; j++) {
if (a[i][j] == 0)
cout << '.';
else
cout << a[i][j];
}
cout << endl;
}
return 0;
}