求助大佬!跟测试数据一样,爆零!QAQ

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

静谧幽蓝 @ 2020-04-09 10:23:09

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s[6]={"","","","","",""};
    string number[11][6]={{
        "",
        "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"
    },{
        "",
        ".",
        ".",
        ".",
        ".",
        "."
    }};
    int n;
    cin>>n;
    char c;
    getchar();
    for(int i=1; i<=n; i++)
    {
        c=getchar();
        for(int j=1; j<=5; j++)
        {
            s[j]+=number[c-'0'][j];
            if(i!=n) s[j]+=number[10][j];
        }
    }
    for(int i=1; i<=5; i++)
    {
        cout<<s[i]<<endl;
    }
    return 0;
}

by 静谧幽蓝 @ 2020-04-09 10:23:59

下载了测试数据,和输出一样,但是说我第一行第三个字符错了


by 静谧幽蓝 @ 2020-04-09 10:24:56

输入: 6 114514

输出:

..X...X.X.X.XXX...X.X.X

..X...X.X.X.X.....X.X.X

..X...X.XXX.XXX...X.XXX

..X...X...X...X...X...X

..X...X...X.XXX...X...X


by _Sakura_Tears_ @ 2020-04-09 10:34:09

建议使用lgIDE查错,因为评测机是一样的


by _Sakura_Tears_ @ 2020-04-09 10:34:17

@toby我最棒!


by 静谧幽蓝 @ 2020-04-10 10:38:43

非常感谢!@_SakuraTears


by jdccc @ 2020-07-20 10:25:53

我和你一样的错误,真是奇怪


|