报错全是第一行过长,没找出来,样例也是对的

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

wuming10086 @ 2024-09-26 22:37:09

#include<iostream>
using namespace std;
int main(){
    string s;
    int n;
    string points[10][5]={{"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."},
    };
    cin>>n>>s;
    for(int j=0;j<5;j++){
        for(int i=0;i<n;i++){
            switch(s[i]){
                case '0':cout<<points[0][j];break;
                case '1':cout<<points[1][j];break;
                case '2':cout<<points[2][j];break;
                case '3':cout<<points[3][j];break;
                case '4':cout<<points[4][j];break;
                case '5':cout<<points[5][j];break;
                case '6':cout<<points[6][j];break;
                case '7':cout<<points[7][j];break;
                case '8':cout<<points[8][j];break;
                case '9':cout<<points[9][j];break;                      
            }
        }
        cout<<endl;
}
    return 0;}

by __Immorta__ @ 2024-09-26 22:51:16

@wuming10086 样例就不对……


by __Immorta__ @ 2024-09-26 22:51:43

@wuming10086 下次能不能细心的找一下,对照一下,一看就能看出来,你每一行后面都有一个点


by wuming10086 @ 2024-09-27 18:48:55

@Immorta 不好意思,之前没看出来


|