为什么和答案对着了但是全wa

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

hyjhyj111 @ 2023-10-10 20:06:11

#include<stdio.h>
int main()
{
    char a[1000],l;
    int b[1000],n;
    char s[10][3][5] ;
    s[0][0][0] = 'X';//0
    s[0][1][0] = 'X';
    s[0][2][0] = 'X';
    s[0][0][1] = 'X';
    s[0][1][1] = '.';
    s[0][2][1] = 'X';
    s[0][0][2] = 'X';
    s[0][1][2] = '.';
    s[0][2][2] = 'X';
    s[0][0][3] = 'X';
    s[0][1][3] = '.';
    s[0][2][3] = 'X';
    s[0][0][4] = 'X';
    s[0][1][4] = 'X';
    s[0][2][4] = 'X';

    s[1][0][0] = '.';//1
    s[1][1][0] = '.';
    s[1][2][0] = 'X';
    s[1][0][1] = '.';
    s[1][1][1] = '.';
    s[1][2][1] = 'X';
    s[1][0][2] = '.';
    s[1][1][2] = '.';
    s[1][2][2] = 'X';
    s[1][0][3] = '.';
    s[1][1][3] = '.';
    s[1][2][3] = 'X';
    s[1][0][4] = '.';
    s[1][1][4] = '.';
    s[1][2][4] = 'X';

    s[2][0][0] = 'X';//2
    s[2][1][0] = 'X';
    s[2][2][0] = 'X';
    s[2][0][1] = '.';
    s[2][1][1] = '.';
    s[2][2][1] = 'X';
    s[2][0][2] = 'X';
    s[2][1][2] = 'X';
    s[2][2][2] = 'X';
    s[2][0][3] = 'X';
    s[2][1][3] = '.';
    s[2][2][3] = '.';
    s[2][0][4] = 'X';
    s[2][1][4] = 'X';
    s[2][2][4] = 'X';

    s[3][0][0] = 'X';//3
    s[3][1][0] = 'X';
    s[3][2][0] = 'X';
    s[3][0][1] = '.';
    s[3][1][1] = '.';
    s[3][2][1] = 'X';
    s[3][0][2] = 'X';
    s[3][1][2] = 'X';
    s[3][2][2] = 'X';
    s[3][0][3] = '.';
    s[3][1][3] = '.';
    s[3][2][3] = 'X';
    s[3][0][4] = 'X';
    s[3][1][4] = 'X';
    s[3][2][4] = 'X';

    s[4][0][0] = 'X';//4
    s[4][1][0] = '.';
    s[4][2][0] = 'X';
    s[4][0][1] = 'X';
    s[4][1][1] = '.';
    s[4][2][1] = 'X';
    s[4][0][2] = 'X';
    s[4][1][2] = 'X';
    s[4][2][2] = 'X';
    s[4][0][3] = '.';
    s[4][1][3] = '.';
    s[4][2][3] = 'X';
    s[4][0][4] = '.';
    s[4][1][4] = '.';
    s[4][2][4] = 'X';

    s[5][0][0] = 'X';//5
    s[5][1][0] = 'X';
    s[5][2][0] = 'X';
    s[5][0][1] = 'X';
    s[5][1][1] = '.';
    s[5][2][1] = '.';
    s[5][0][2] = 'X';
    s[5][1][2] = 'X';
    s[5][2][2] = 'X';
    s[5][0][3] = '.';
    s[5][1][3] = '.';
    s[5][2][3] = 'X';
    s[5][0][4] = 'X';
    s[5][1][4] = 'X';
    s[5][2][4] = 'X';

    s[6][0][0] = 'X';//6
    s[6][1][0] = 'X';
    s[6][2][0] = 'X';
    s[6][0][1] = 'X';
    s[6][1][1] = '.';
    s[6][2][1] = '.';
    s[6][0][2] = 'X';
    s[6][1][2] = 'X';
    s[6][2][2] = 'X';
    s[6][0][3] = 'X';
    s[6][1][3] = '.';
    s[6][2][3] = 'X';
    s[6][0][4] = 'X';
    s[6][1][4] = 'X';
    s[6][2][4] = 'X';

    s[7][0][0] = 'X';//7
    s[7][1][0] = 'X';
    s[7][2][0] = 'X';
    s[7][0][1] = '.';
    s[7][1][1] = '.';
    s[7][2][1] = 'X';
    s[7][0][2] = '.';
    s[7][1][2] = '.';
    s[7][2][2] = 'X';
    s[7][0][3] = '.';
    s[7][1][3] = '.';
    s[7][2][3] = 'X';
    s[7][0][4] = '.';
    s[7][1][4] = '.';
    s[7][2][4] = 'X';

    s[8][0][0] = 'X';//8
    s[8][1][0] = 'X';
    s[8][2][0] = 'X';
    s[8][0][1] = 'X';
    s[8][1][1] = '.';
    s[8][2][1] = 'X';
    s[8][0][2] = 'X';
    s[8][1][2] = 'X';
    s[8][2][2] = 'X';
    s[8][0][3] = 'X';
    s[8][1][3] = '.';
    s[8][2][3] = 'X';
    s[8][0][4] = 'X';
    s[8][1][4] = 'X';
    s[8][2][4] = 'X';

    s[9][0][0] = 'X';//9
    s[9][1][0] = 'X';
    s[9][2][0] = 'X';
    s[9][0][1] = 'X';
    s[9][1][1] = '.';
    s[9][2][1] = 'X';
    s[9][0][2] = 'X';
    s[9][1][2] = 'X';
    s[9][2][2] = 'X';
    s[9][0][3] = '.';
    s[9][1][3] = '.';
    s[9][2][3] = 'X';
    s[9][0][4] = 'X';
    s[9][1][4] = 'X';
    s[9][2][4] = 'X';
    scanf("%d",&n);
    scanf("%c",&l);
    for(int i = 0;i < n;i++)
    {
        scanf("%c",&a[i]);
        b[i] = a[i] - '0';
    }
    for(int j = 0;j < 5;j++)
    {
        for(int i = 0 ;i < n;i++)
        {
            for(int k = 0; k < 3;k++)
            {
                printf("%c",s[b[i]][k][j]);
            }
            if(i == n - 1) continue;
            printf(".");
        }
        if(j < 4)
        printf("\n");
    }

    return 0;
}

by 70CentsApple @ 2023-10-16 21:27:29

scanf("%d",&n);
scanf("%c",&l);

改成

scanf("%d\n",&n);

评测记录


by hyjhyj111 @ 2023-10-27 19:55:19

@70CentsApple 感谢大佬


|