样例能过,全WA

P5730 【深基5.例10】显示屏

BLX32M_10 @ 2022-02-19 19:30:00

#include <cstdio>

char dig[10][5][7] =
{
{"XXX","X.X","X.X","X.X","XXX"},
{"..X","..X","..X","..X","..X"},
{"XXX","..X","XXX","X..","XXX"},
{"XXX","..X","XXX","..X","XXX"},
{"X.X","X.X","XXX","..X","..X"},
{"XXX","X..","XXX","..X","XXX"},
{"XXX","X..","XXX","X.X","XXX"},
{"XXX","..X","..X","..X","..X"},
{"XXX","X.X","XXX","X.X","XXX"},
{"XXX","X.X","XXX","..X","XXX"}
}, res[6][1005];

int main()
{
    int n, x, col = 0;
    scanf("%d", &n);
    for (int k = 0; k < n; k++)
    {
        scanf("%1d", &x);
        for (int i = 0; i < 5; i++)
            for (int j = 0; j < 3; j++)
                res[i][col + j] = dig[x][i][j];
        for (int i = 0; i < 5; i++)
            res[i][col + 3] = '.';
        col += 4;
    }
    for (int i = 0; i < 5; i++)
    {
        for (int j = 0; j < col - 1; j++)
        {   
            putchar(res[i][j]);
            putchar(' ');
        }
        putchar('\n');
    }
    return 0;
}

by xzy090626 @ 2022-02-19 19:44:11

@Brooksx 样例没过啊

putchar(' ');

题目中未要求输出空格


by BLX32M_10 @ 2022-02-19 21:07:21

@xzy090626 orz 感谢


|