好奇怪啊!输出不了b数组

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

only76 @ 2020-05-26 16:16:38

#include<cstdio>
#include<iomanip>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<math.h>
#include <string>
#include<cmath>
using namespace std;
int b[100];
int n;
string a[10][5]=
    {
        {"XXX","X.X","X.X","X.X","XXX"},//0
        {"..X","..X","..X","..X","..X"},//1
        {"XXX","..X","XXX","X..","XXX"},//2
        {"XXX","..X","XXX","..X","XXX"},//3
        {"X.X","X.X","XXX","..X","..X"},//4
        {"XXX","X..","XXX","..X","XXX"},//5
        {"XXX","X..","XXX","X.X","XXX"},//6
        {"XXX","..X","..X","..X","..X"},//7
        {"XXX","X.X","XXX","X.X","XXX"},//8
        {"XXX","X.X","XXX","..X","XXX"},//9
    };
int main()
{
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>b[i];

    }

//    for(int i=0; i<n; i++)
//    {
//        for(int j=0; j<=5; j++)
//        {
//            cout<<a[b[i]][j];
//        }
//    }

for(int j=0;j<n;j++)
{
    cout<<b[j];
}

}

by 天命之路 @ 2020-05-26 16:22:58

注意到样例中没有空格(不能用 cin)


by 天命之路 @ 2020-05-26 16:23:06

@only76


by only76 @ 2020-05-26 16:37:46

2 23 31 1 14 19 17 18 12 8 9 23 1 16 7 11 7 10 21 2 9 31 嗯只能输出带空格隔开的


|