不知道哪错了,c++求助

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

Etic_HAO @ 2022-08-28 13:23:55

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

int n;
string s;

int main(){
    cin>>n>>s;
    for(int i=1;i<=5;i++){
        for(int j=1;j<=n;j++){
            if(i==1){
                if(s[j]!=1&&s[j]!=4) cout<<"XXX";
                else if(s[j]=='1') cout<<"..X";
                else cout<<"X.X";
            }
            else if(i==2){
                if(s[j]=='0'||s[j]=='4'||s[j]=='8'||s[j]=='9') cout<<"X.X";
                else cout<<"..X";
            }
            else if(i==3){
                if(s[j]=='0') cout<<"X.X";
                else if(s[j]=='1'||s[j]=='7') cout<<"..X";
                else cout<<"XXX";
            }
            else if(i==4){
                if(s[j]=='2') cout<<"X..";
                else if(s[j]==0||s[j]=='6'||s[j]=='8') cout<<"X.X";
            }
            else if(i==5){
                if(s[j]=='1'||s[j]=='4'||s[j]=='7') cout<<"..X";
                else cout<<"XXX";
            }
            if(j!=n) cout<<".";
            else cout<<endl;
        }
    }
}

|