Files
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

42 lines
1.3 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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++) { // 6行
for (int j = y; j <= y + 6; j++) { // 7列
if (a[i][j] == 0)
cout << '.';
else
cout << a[i][j];
}
cout << endl;
}
return 0;
}