大佬们请教一下这道题,示例过了没问题,但全WA

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

thy3067666461 @ 2023-07-19 00:17:44

#include <stdio.h>
#include <math.h>
int main(){
    int n;   
    scanf("%d",&n);
    int ru;
    int shuru[n];
    char shuchu[4*n-1][5];
    scanf("%d",&ru);
    for(int i=0;i<=n-1;i++){
        shuru[i]=ru/(pow(10,n-i-1));
        ru-=pow(10,n-1-i)*shuru[i];
    }
    for(int i=0;i<=n-1;i++){
        if(i!=n){
                 shuchu[4*i+3][0]='.';shuchu[4*i+3][1]='.';shuchu[4*i+3][2]='.';shuchu[4*i+3][3]='.';shuchu[4*i+3][4]='.';
        }
        if (shuru[i]==0){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X';
            shuchu[4*i][1]='X';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X';
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='.';shuchu[4*i+2][2]='X';
            shuchu[4*i][3]='X';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==1){
            shuchu[4*i][0]='.';shuchu[4*i+1][0]='.';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='.';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='.';shuchu[4*i+1][2]='.';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='.';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='.';shuchu[4*i+1][4]='.';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==2){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='.';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='X';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='.'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==3){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='.';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='.';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==4){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='.';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='X';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='.';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='.';shuchu[4*i+1][4]='.';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==5){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='X';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='.';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==6){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='X';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='.'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='X';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==7){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='.';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='.';shuchu[4*i+1][2]='.';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='.';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='.';shuchu[4*i+1][4]='.';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==8){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='X';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='X';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }
         if (shuru[i]==9){
            shuchu[4*i][0]='X';shuchu[4*i+1][0]='X';shuchu[4*i+2][0]='X'; 
            shuchu[4*i][1]='X';shuchu[4*i+1][1]='.';shuchu[4*i+2][1]='X'; 
            shuchu[4*i][2]='X';shuchu[4*i+1][2]='X';shuchu[4*i+2][2]='X'; 
            shuchu[4*i][3]='.';shuchu[4*i+1][3]='.';shuchu[4*i+2][3]='X'; 
            shuchu[4*i][4]='X';shuchu[4*i+1][4]='X';shuchu[4*i+2][4]='X'; 
            continue;
        }

    }
    for(int i=0;i<=4;i++){
        for(int m=0;m<=4*n-2;m++){
            printf("%c",shuchu[m][i]);
        }
        if(i!=4){
            printf("\n");
        }
    }

}

by LiJoQiao @ 2023-07-19 07:58:10

你看一下你的 5 标了啥


by thy3067666461 @ 2023-07-19 10:32:06

@LiJoQiao 啊这,明白了,谢谢


|