C++全wa求助!

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

LeoGua @ 2024-09-29 20:55:08


#include<bits/stdc++.h>
using namespace std;

struct cp
{
    int d[12];
};

cp x[1005];

int main()
{

    int n;
    cin>>n;
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='0' || a[i]=='2' || a[i]=='3' || a[i]=='5' || a[i]=='6' || a[i]=='7' || a[i]=='8' || a[i]=='9')
        {
            cout<<"XXX";
        }
        if(a[i]=='1')
        {
            cout<<"..X";
        }
        if(a[i]=='4')
        {
            cout<<"X.X";
        }
        if(i!=a.size()-1)
        {
            cout<<".";
        }
    }
    cout<<'\n';

    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='0' || a[i]=='4' || a[i]=='8' || a[i]=='9')
        {
            cout<<"X.X";
        }
        if(a[i]=='1' || a[i]=='2' || a[i]=='3' || a[i]=='7')
        {
            cout<<"..X";
        }
        if(a[i]=='5' || a[i]=='6')
        {
            cout<<"X..";
        }
        if(i!=a.size()-1)
        {
            cout<<".";
        }
    }
    cout<<'\n';

    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='2' || a[i]=='3' || a[i]=='4' || a[i]=='5' || a[i]=='6' || a[i]=='8' || a[i]=='9')
        {
            cout<<"XXX";
        }
        if(a[i]=='1' || a[i]=='7')
        {
            cout<<"..X";
        }
        if(a[i]=='0')
        {
            cout<<"X.X";
        }
        if(i!=a.size()-1)
        {
            cout<<".";
        }
    }
    cout<<'\n';

    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='1' || a[i]=='3' || a[i]=='4' || a[i]=='5' || a[i]=='7' || a[i]=='9')
        {
            cout<<"..X";
        }

        if(a[i]=='6'||a[i]=='8'||a[i]=='0')
        {
            cout<<"X.X";
        }
        if(a[i]=='2')
        {
            cout<<"X..";
        }
        if(i!=a.size()-1)
        {
            cout<<".";
        }   
    }
    cout<<'\n';

    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='0' || a[i]=='2' || a[i]=='3' || a[i]=='5' || a[i]=='6' ||a[i]=='8'|| a[i]=='9')
        {
            cout<<"XXX";
        }
        else
        {
            cout<<"..x";
        }
        if(i!=a.size()-1)
        {
            cout<<".";
        }
    }

    return 0;
}

|