求各位大佬看看到底错哪了?崩溃了

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

wzy3130601449 @ 2022-04-30 17:12:42

#include<stdio.h>
int main(){
    char a[5][10][5]={"XXX","..X","XXX","XXX","X.X","XXX","XXX","XXX","XXX","XXX",
                      "X.X","..X","..X","..X","X.X","X..","X..","..X","X.X","X.X",
                      "X.X","..X","XXX","XXX","XXX","XXX","XXX","..X","XXX","XXX",
                      "X.X","..X","X..","..X","..X","..X","X.X","..X","X.X","..X",
                      "XXX","..X","XXX","XXX","..X","XXX","XXX","..X","XXX","X.X"};
    int n,i,j;
    scanf("%d",&n);
    char str[n];
    for(i=0;i<n;i++)
        scanf(" %c",&str[i]);
    for(j=0;j<5;j++)
        for(i=0;i<n;i++)
            printf("%s%s%s",(i?".":""),a[j][(int)(str[i]-'0')],(i==n-1?"\n":""));
    return 0;
}

by qip101 @ 2022-04-30 17:18:58

@wzy3130601449 char数组错了自己再仔细阅读阅读题目


by wzy3130601449 @ 2022-04-30 17:21:50

@MLBZSSK 没看懂?什么意思呀?


by qip101 @ 2022-04-30 17:36:15

@wzy3130601449 认真看样例数好中间的点


by wzy3130601449 @ 2022-04-30 17:39:58

@MLBZSSK 我有打点了呀!


by qip101 @ 2022-04-30 17:41:14

@wzy3130601449 打点方法不对啊哥哥


by wzy3130601449 @ 2022-04-30 17:43:20

@MLBZSSK 应该怎么打点呀,不是每位数字之间打一个点吗?


by qip101 @ 2022-04-30 17:48:42

@wzy3130601449 那你的1和2之间有点吗?


by wzy3130601449 @ 2022-04-30 17:51:48

@MLBZSSK 有呀?这里怎么上传图片呀?想给你看看我运行的结果!


by qip101 @ 2022-04-30 17:53:04

@wzy3130601449 可以用洛谷图床


by wzy3130601449 @ 2022-04-30 17:54:16

@MLBZSSK 不知道怎么弄?,洛谷没用多久!


| 下一页