求助!测试点过了但全WA

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

wmyQAQ @ 2023-08-03 11:41:37


#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int n;
    char a[105];
    cin>>n;
    for(int i=1;i<=n+1;i++)
        scanf("%c",&a[i-1]);
    for(int i=1;i<=5;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(i==1)
            {
                if(a[j]=='0'||a[j]=='2'||a[j]=='3'||a[j]=='5'||a[j]=='6'||a[j]=='7'||a[j]=='8'||a[j]=='9') cout<<"XXX";
                else if(a[j]=='1') cout<<"..X";
                else if(a[j]=='4') cout<<"X.X";

            }
            else if(i==2)
            {
                if(a[j]=='0'||a[j]=='8'||a[j]=='9') cout<<"X.X";
                else if(a[j]=='1'||a[j]=='2'||a[j]=='3'||a[j]=='7') cout<<"..X";
                else if(a[j]=='4') cout<<"X.X";
                else if(a[j]=='5'||a[j]=='6') cout<<"X..";
            }
            else if(i==3)
            {
                if(a[j]=='0') cout<<"X.X";
                else if(a[j]=='1'||a[j]=='7') cout<<"..X";
                else if(a[j]=='2'||a[j]=='3'||a[j]=='4'||a[j]=='5'||a[j]=='6'||a[j]=='8'||a[j]=='9') cout<<"XXX";
            }
            else if(i==4)
            {
                if(a[j]=='0'||a[j]=='6'||a[j]=='8') cout<<"X.X";
                else if(a[j]=='1'||a[j]=='3'||a[j]=='4'||a[j]=='5'||a[j]=='7'||a[j]=='9') cout<<"..X";
                else if(a[j]=='2') cout<<"X..";
            }
            else if(i==5)
            {
                if(a[j]=='0'||a[j]=='2'||a[j]=='3'||a[j]=='5'||a[j]=='6'||a[j]=='8'||a[j]=='9') cout<<"XXX";
                else if(a[j]=='1'||a[j]=='4'||a[j]=='7') cout<<"..X";
            }
            if(j<n) cout<<".";
        }
        if(i<5) cout<<endl;
    }
    return 0;
 } 

|