c++本地能过,提交全wa,求助

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

zilove @ 2024-12-05 21:38:54

本地都可以过,用的cin和cout也错了

#include <bits/stdc++.h>
using namespace std;
char s[105];
int main(){
    int n;
    cin>>n;
    cin>>s;
    //第1行
    for(int i=0;i<n;i++){
        switch (s[i]){
        case '0':cout<<"xxx";break;
        case '1':cout<<"..x";break;
        case '2':cout<<"xxx";break;
        case '3':cout<<"xxx";break;
        case '4':cout<<"x.x";break;
        case '5':cout<<"xxx";break;
        case '6':cout<<"xxx";break;
        case '7':cout<<"xxx";break;
        case '8':cout<<"xxx";break;
        case '9':cout<<"xxx";break;
        }
        if(i!=n-1){
            cout<<".";
        }
    }
    //2
    cout<<endl;
    for(int i=0;i<n;i++){
        switch (s[i]){
        case '0':cout<<"x.x";break;
        case '1':cout<<"..x";break;
        case '2':cout<<"..x";break;
        case '3':cout<<"..x";break;
        case '4':cout<<"x.x";break;
        case '5':cout<<"x..";break;
        case '6':cout<<"x..";break;
        case '7':cout<<"..x";break;
        case '8':cout<<"x.x";break;
        case '9':cout<<"x.x";break;
        }
        if(i!=n-1){
            cout<<".";
        }
    }
    //3
    cout<<endl;
    for(int i=0;i<n;i++){
        switch (s[i]){
        case '0':cout<<"x.x";break;
        case '1':cout<<"..x";break;
        case '2':cout<<"xxx";break;
        case '3':cout<<"xxx";break;
        case '4':cout<<"xxx";break;
        case '5':cout<<"xxx";break;
        case '6':cout<<"xxx";break;
        case '7':cout<<"..x";break;
        case '8':cout<<"xxx";break;
        case '9':cout<<"xxx";break;
        }
        if(i!=n-1){
            cout<<".";
        }
    }
    //4
    cout<<endl;
    for(int i=0;i<n;i++){
        switch (s[i]){
        case '0':cout<<"x.x";break;
        case '1':cout<<"..x";break;
        case '2':cout<<"x..";break;
        case '3':cout<<"..x";break;
        case '4':cout<<"..x";break;
        case '5':cout<<"..x";break;
        case '6':cout<<"x.x";break;
        case '7':cout<<"..x";break;
        case '8':cout<<"x.x";break;
        case '9':cout<<"..x";break;
        }
        if(i!=n-1){
            cout<<".";
        }
    }
    //5
    cout<<endl;
    for(int i=0;i<n;i++){
        switch (s[i]){
        case '0':cout<<"xxx";break;
        case '1':cout<<"..x";break;
        case '2':cout<<"xxx";break;
        case '3':cout<<"xxx";break;
        case '4':cout<<"..x";break;
        case '5':cout<<"xxx";break;
        case '6':cout<<"xxx";break;
        case '7':cout<<"..x";break;
        case '8':cout<<"xxx";break;
        case '9':cout<<"xxx";break;
        }
        if(i!=n-1){
            cout<<".";
        }
    }
}

by iamsh @ 2024-12-05 21:45:05

本地真的过了吗


by duantong @ 2024-12-05 21:48:46

@zilove
'X'要大写 求关


by zilove @ 2024-12-05 21:57:40

@duantong 感谢,还真是这问题,我也是醉了


|