全wa,悬关(唉

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

lucy2012 @ 2024-02-26 18:54:34

#include<bits/stdc++.h>
using namespace std;
char a[10][5][3]{{'x','x','x',
            'x','.','x',
                 'x','.','x',
                 'x','.','x',
                 'x','x','x',
                 },
                 {'.','.','x',
                  '.','.','x',
                  '.','.','x',
                  '.','.','x',
                  '.','.','x',},
                 {'x','x','x',
                  '.','.','x',
                  'x','x','x',
                  'x','.','.',
                  'x','x','x',
                  },
                 {'x','x','x',
                  '.','.','x',
                  'x','x','x',
                  '.','.','x',
                  'x','x','x',},
                 {'x','.','x',
                  'x','.','x',
                  'x','x','x',
                  '.','.','x',
                  '.','.','x',
                  },
                 {'x','x','x',
                  'x','.','.',
                  'x','x','x',
                  '.','.','x',
                  'x','x','x',
                  },
                 {'x','x','x',
                  'x','.','.',
                  'x','x','x',
                  'x','.','x',
                  'x','x','x',
                 },
                 {'x','x','x',
                  '.','.','x',
                  '.','.','x',
                  '.','.','x',
                  '.','.','x',
                 },
                 {'x','x','x',
                  'x','.','x',
                  'x','x','x',
                  'x','.','x',
                  'x','x','x',  
                 },
                 {'x','x','x',
                  'x','.','x',
                  'x','x','x',
                  '.','.','x',
                  'x','x','x',
                 },
                };
int main()
{   
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<5;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<3;k++){
                cout<<a[s[j]-'0'][i][k];
            }
            if(j!=n-1)
                cout<<'.';
        }
        cout<<endl;
    }
    return 0;
}

by Henry2012 @ 2024-02-26 18:59:33

显示屏上是大写的X,你的全是小写


by Henry2012 @ 2024-02-26 19:00:03

@lucy2012


by quxiangyu @ 2024-02-26 19:13:10

@lucy2012 @lucy2012 ( ̄︶ ̄*))

#include<cstdio>
using namespace std;
char c[10][5][4]= 
{
    "XXX",
    "X.X",
    "X.X",
    "X.X",
    "XXX",
    "..X",
    "..X",
    "..X",
    "..X",
    "..X",
    "XXX",
    "..X",
    "XXX",
    "X..",
    "XXX",
    "XXX",
    "..X",
    "XXX",
    "..X",
    "XXX",
    "X.X",
    "X.X",
    "XXX",
    "..X",
    "..X",
    "XXX",
    "X..",
    "XXX",
    "..X",
    "XXX",
    "XXX",
    "X..",
    "XXX",
    "X.X",
    "XXX",
    "XXX",
    "..X",
    "..X",
    "..X",
    "..X",
    "XXX",
    "X.X",
    "XXX",
    "X.X",
    "XXX",
    "XXX",
    "X.X",
    "XXX",
    "..X",
    "XXX"
},ans[10][1000];
int main(){
    int n,a,s=0;
    scanf("%d",&n);
    while(n--){
        scanf("%1d",&a);
        for(int i=0;i<5;i++)
            for(int j=0;j<3;j++)
                ans[i][s+j]=c[a][i][j];
        for(int i=0;i<5;i++) ans[i][s+3]='.';
        s+=4;
    }
    for(int i=0;i<5;i++){
        for(int j=0;j<s-1;j++) printf("%c",ans[i][j]);
        printf("\n");
    }
    return 0;
}

by lucy2012 @ 2024-02-26 19:22:44

@quxiangyu @Henry2012 草。。。。。。谢谢


by wmyQAQ @ 2024-02-26 23:09:54

@Henry2012

求dalao看看我这个也是全WA,下的第一个样例看的没问题

WA的解释是“Wrong Answer.wrong answer On line 1 column 3, read ., expected X.”,但是实际本地该位置是对的

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int n;
    char a[105],ch;
    cin>>n;
    ch=getchar();
    for(int i=1;i<=n;i++)
        scanf("%c",&a[i]);
    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;
 } 

|