0分,样例对

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

AcxxMz @ 2022-12-15 10:23:44

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tubes[10][8]=
    {
        {6,0,1,2,4,5,6},{2,2,5},{5,0,2,3,4,6},{5,0,2,3,5,6},
        {4,1,2,3,5},{5,0,1,3,5,6},{6,0,1,3,4,5,6},{3,0,2,5},
        {7,0,1,2,3,4,5,6},{6,0,1,2,3,5,6}
    };
    int dot[7][3][2]=
    {
        {{0,0},{0,1},{0,2}},
        {{0,0},{1,0},{2,0}},
        {{0,2},{1,2},{2,2}},
        {{2,0},{2,1},{2,2}},
        {{2,0},{3,0},{4,0}},
        {{2,2},{3,2},{4,2}},
        {{4,0},{4,1},{4,2}},
    };
    char num[110],out[5][500];
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>num[i];
    for(int i=0;i<5;i++)
        for(int j=0;j<4*n-1;j++)
            out[i][j]='.';
    for(int i=0;i<n;i++)
    {
        int basex=0,basey=i*4,digit=num[i]-'0';
        for(int j=1;j<=tubes[digit][0];j++)
        {
            int tubenum=tubes[digit][j];
            out[basex+dot[tubenum][0][0]][basey+dot[tubenum][0][1]]='x';
            out[basex+dot[tubenum][1][0]][basey+dot[tubenum][1][1]]='x';
            out[basex+dot[tubenum][2][0]][basey+dot[tubenum][2][1]]='x';
        }
    }
    for(int i=0;i<5;i++,cout<<endl)
        for(int j=0;j<4*n-1;j++)
            cout<<out[i][j];
    return 0;
}

by CSP_AK_I @ 2022-12-15 10:29:29

#include<bits/stdc++.h>
using namespace std;
char a[105];
int main(){
    int n;
    cin>>n;
    for(int i = 1;i<=n;i++){
        cin>>a[i];
    }
    for(int i = 1;i<=n;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!=n){
            cout<<".";
        }
    } 
    cout<<endl;
    for(int i = 1;i<=n;i++){
        if(a[i]=='1'||a[i]=='2'||a[i]=='3'||a[i]=='7'){
            cout<<"..X";
        }
        if(a[i]=='0'||a[i]=='4'||a[i]=='8'||a[i]=='9'){
            cout<<"X.X";
        }
        if(a[i]=='5'||a[i]=='6'){
            cout<<"X..";
        }
        if(i!=n){
            cout<<".";
        }
    }
    cout<<endl;
    for(int i = 1;i<=n;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]=='7'||a[i]=='1'){
            cout<<"..X";
        }
        if(a[i]=='0'){
            cout<<"X.X";
        }
        if(i!=n){
            cout<<".";
        }
    }
    cout<<endl;
    for(int i = 1;i<=n;i++){
        if(a[i]=='1'||a[i]=='3'||a[i]=='7'||a[i]=='4'||a[i]=='5'||a[i]=='9'){
            cout<<"..X";
        }
        if(a[i]=='0'||a[i]=='6'||a[i]=='8'){
            cout<<"X.X";
        }
        if(a[i]=='2'){
            cout<<"X..";
        }
        if(i!=n){
            cout<<".";
        }
    }
    cout<<endl;
    for(int i = 1;i<=n;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";
        }
        if(a[i]=='1'||a[i]=='4'||a[i]=='7'){
            cout<<"..X";
        }
        if(i!=n){
            cout<<".";
        }
    }
}

by 编码落寞 @ 2022-12-15 10:31:23

@1234aaa

很明显,你的X小写了


by AcxxMz @ 2022-12-15 10:34:03

好吧,被自己无语到了


|