万灭、蓝鲸 @ 2021-08-20 13:14:38
RT
#include <bits/stdc++.h>
using namespace std;
int len;
string s;
char ch[15][1005];
int read()
{
int sum = 0, w = 1;
char ch = getchar();
while (ch != '-' && !isdigit(ch)) ch = getchar();
if (ch == '-') w = -1, ch = getchar();
while(isdigit(ch)) sum = (sum << 3) + (sum << 1) + ch - '0', ch = getchar();
return sum * w;
}
void draw(int sx, int sy, int goal)
{
if (goal == 0)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy] = ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy] = ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
if (goal == 1)
{
ch[sx][sy + 2] = 'X';
ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy + 2] = 'X';
}
if (goal == 2)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
if (goal == 3)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
if (goal == 4)
{
ch[sx][sy] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy] = ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy + 2] = 'X';
}
if (goal == 5)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
if (goal == 6)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2]= 'X';
ch[sx + 3][sy] = ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
if (goal == 7)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy + 2] = 'X';
}
if (goal == 8)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy] = ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy] = ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
if (goal == 9)
{
ch[sx][sy] = ch[sx][sy + 1] = ch[sx][sy + 2] = 'X';
ch[sx + 1][sy] = ch[sx + 1][sy + 2] = 'X';
ch[sx + 2][sy] = ch[sx + 2][sy + 1] = ch[sx + 2][sy + 2] = 'X';
ch[sx + 3][sy + 2] = 'X';
ch[sx + 4][sy] = ch[sx + 4][sy + 1] = ch[sx + 4][sy + 2] = 'X';
}
}
int main()
{
memset(ch, '.', sizeof(ch));
len = read();
getline(cin, s);
s = " " + s;
for (int i = 1, ty = 1; i <= len; i++, ty += 4)
draw(1, ty, s[i] - '0');
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= len * 4 - 1; j++)
printf("%c", ch[i][j]);
printf("\n");
}
return 0;
}
by hzlcdkslds @ 2021-08-20 13:41:40
用cin试试
by yuwenxiang1017 @ 2021-08-20 13:56:50
0要特殊对待吗
by yuwenxiang1017 @ 2021-08-20 13:58:04
数据似乎没有限制0
by 万灭、蓝鲸 @ 2021-08-20 21:40:30
@hsladafjsk A了谢谢