174 条题解

  • 1
    @ 2017-05-07 22:26:14
    /*
    模拟
    为了使程序简便,使用常量数组将每个数字的写法存下。
    每个数字都可以分成5个部分:上横,上竖,中横,下竖,下横(从上往下,其中竖有多种情况),
    输出时就按照这5部分输出,可以发现横和竖的输出是相似的,可以合并在一起。
    反正我是懒得写QAQ
    */
    #include <iostream>
    #include <cstring>
    #include <cstdio>
    using namespace std;
    int k,st;
    char s[256];
    int main()
    {
        scanf("%d",&k);
        st=k;
        cin>>s;
        for (int l=1;l<=5;l++)
        {
            if (l==1 || l==3 || l==5)
                st=1;
            else st=k;
            for (int j = 1; j <= st; j++)
            {    
               for (int i=0;i<strlen(s);i++)
                {
                    if (l==1)
                        {    
                           if (i==0) cout<<" ";
                           if (s[i]!='4' && s[i]!='1') {for (int i=1;i<=k;i++) cout<<"-"; cout<<"   "; }
                           else {for (int q=1;q<=k;q++) cout<<" "; cout<<"   ";}
                        }
                    if (l==2)
                        {
                            if (s[i] == '2' || s[i] == '3' || s[i] == '7' || s[i] == '1')
                            { cout<<" "; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; }
                            else if (s[i] == '5' || s[i] == '6')
                            { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<"  "; }
                            else 
                            { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; }
                        }
                    if (l==3)
                        {
                           if (i==0) cout<<" ";
                           if (s[i] == '7' || s[i] == '0' || s[i] == '1') {for (int q=1;q<=k;q++) cout<<" "; cout<<"   ";}
                           else {for (int q=1;q<=k;q++) cout<<"-"; cout<< "   ";}
                        }
                    if (l==4)
                        {
                            if (s[i] == '4' || s[i] == '3' || s[i] == '7' || s[i] == '9' || s[i] == '5' || s[i] == '1')
                            { cout<<" "; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; }
                            else if (s[i] == '2')
                            { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<"  "; }
                            else 
                            { cout<<"|"; for (int q=1;q<=k;q++) cout<<" "; cout<<"| "; }
                        }
                    if (l==5)
                        {
                            if (i==0) cout<<" ";
                            if (s[i]!='4' && s[i]!='1' && s[i]!='7') {for (int i=1;i<=k;i++) cout<<"-"; cout<<"   "; }
                            else {for (int q=1;q<=k;q++) cout<<" "; cout<<"   ";}
                        }
                }
               cout<<endl;
            }
        }
    }
    
    
  • 0
    @ 2021-08-28 20:03:07
    #include<bits/stdc++.h>
    using namespace std;
    
    int main()
    {
        int k;
        string s,m[10]={"-|| ||-","  |  | ","- |-| -",
                        "- |- |-"," ||- | ",    "-| - |-","-| -||-",
                        "- |  | ","-||-||-","-||- |-"};
        cin>>k>>s;
        for(int p=0; p<7; p++){
            if(p==2 || p==5)
                continue;
            if(p%3==0){
                for(int i=0; i<s.size(); i++){
                    cout<<" ";
                    for(int j=0; j<k; j++)
                        cout<<m[s[i]-48][p];
                    cout<<"  ";
                }
                cout<<"\n";        
            }else{
                for(int q=0; q<k; q++){
                    for(int i=0; i<s.size(); i++){
                        cout<<m[s[i]-48][p];
                        for(int j=0; j<k; j++)
                            cout<<" ";
                        cout<<m[s[i]-48][p+1]<<" ";
                    }
                    cout<<"\n";
                }
            }
        }
        return 0;
    }
    
  • 0
    @ 2018-07-28 08:11:18
    #include <bits/stdc++.h>
    using namespace std;
    #define FOR(i,n) for (int i=1;i<=n;i++)
    #define REP(i,a,b) for (int i=a;i<=b;i++)
    #define pb push_back
    #define mp make_pair
    #define ll long long
    #define pos(x,y) (x+(y)*n)
    const int N=100000+10;
    const int inf=0x3f3f3f3f;
    const ll mod=1000000007;
    const double eps=1e-8;
    
    int a[10][7]={
    {1,1,1,0,1,1,1},
    {0,0,1,0,0,1,0},
    {1,0,1,1,1,0,1},
    {1,0,1,1,0,1,1},
    {0,1,1,1,0,1,0},
    {1,1,0,1,0,1,1},
    {1,1,0,1,1,1,1},
    {1,0,1,0,0,1,0},
    {1,1,1,1,1,1,1},
    {1,1,1,1,0,1,1}
    };
    int n;
    string s;
    char g[40][40*255];
    int main() {
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
        cin>>n;
        cin>>s;
        int m=s.size();
        for (int i=0;i<s.size();i++) {
            int t=s[i]-'0';
            if (a[t][0]) {
                int start=i*(n+3)+2;
                REP(j,start,start+n-1) {
                    g[1][j]='-';
                }
            }
            if (a[t][3]) {
                int start=i*(n+3)+2;
                REP(j,start,start+n-1) {
                    g[2+n][j]='-';
                }
            }
            if (a[t][6]) {
                int start=i*(n+3)+2;
                REP(j,start,start+n-1) {
                    g[3+2*n][j]='-';
                }
            }
            if (a[t][1]) {
                int start=i*(n+3)+1;
                REP(j,2,2+n-1) {
                    g[j][start]='|';
                }
            }
            if (a[t][2]) {
                int start=i*(n+3)+1+n+1;
                REP(j,2,2+n-1) {
                    g[j][start]='|';
                }
            }
            if (a[t][4]) {
                int start=i*(n+3)+1;
                REP(j,3+n,3+n+n-1) {
                    g[j][start]='|';
                }
            }
            if (a[t][5]) {
                int start=i*(n+3)+1+n+1;
                REP(j,3+n,3+n+n-1) {
                    g[j][start]='|';
                }
            }
        }
        FOR(i,2*n+3) {
            FOR(j,m*(n+3)-1) {
                if (g[i][j]==0) {
                    cout<<" ";
                } else cout<<g[i][j];
            }
            cout<<endl;
        }
        return 0;
    }
    
  • 0
    @ 2017-08-02 03:48:40

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int k;
    int main()
    {
    string a;
    cin>>k;
    cin>>a;
    for(int i=0;i<=a.size()-1;++i)
    {
    if(i==0)cout<<" ";
    if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
    cout<<" ";
    }
    cout<<endl;
    for(int j=1;j<=k;++j)
    {
    for(int i=0;i<=a.size()-1;++i)
    {
    if(a[i]=='1')
    {
    for(int w=1;w<=k+1;++w)cout<<" ";

    cout<<"|";

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

    cout<<"|";

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

  • 0
    @ 2017-08-02 03:48:19

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int k;
    int main()
    {
    string a;
    cin>>k;
    cin>>a;
    for(int i=0;i<=a.size()-1;++i)
    {
    if(i==0)cout<<" ";
    if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
    cout<<" ";
    }
    cout<<endl;
    for(int j=1;j<=k;++j)
    {
    for(int i=0;i<=a.size()-1;++i)
    {
    if(a[i]=='1')
    {
    for(int w=1;w<=k+1;++w)cout<<" ";

    cout<<"|";

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

    cout<<"|";

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

  • 0
    @ 2017-08-02 03:48:03

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int k;
    int main()
    {
    string a;
    cin>>k;
    cin>>a;
    for(int i=0;i<=a.size()-1;++i)
    {
    if(i==0)cout<<" ";
    if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
    cout<<" ";
    }
    cout<<endl;
    for(int j=1;j<=k;++j)
    {
    for(int i=0;i<=a.size()-1;++i)
    {
    if(a[i]=='1')
    {
    for(int w=1;w<=k+1;++w)cout<<" ";

    cout<<"|";

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

    cout<<"|";

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

  • 0
    @ 2017-08-02 03:47:40

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int k;
    int main()
    {
    string a;
    cin>>k;
    cin>>a;
    for(int i=0;i<=a.size()-1;++i)
    {
    if(i==0)cout<<" ";
    if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
    cout<<" ";
    }
    cout<<endl;
    for(int j=1;j<=k;++j)
    {
    for(int i=0;i<=a.size()-1;++i)
    {
    if(a[i]=='1')
    {
    for(int w=1;w<=k+1;++w)cout<<" ";

    cout<<"|";

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

    cout<<"|";

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

  • 0
    @ 2017-08-02 03:47:40

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int k;
    int main()
    {
    string a;
    cin>>k;
    cin>>a;
    for(int i=0;i<=a.size()-1;++i)
    {
    if(i==0)cout<<" ";
    if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
    cout<<" ";
    }
    cout<<endl;
    for(int j=1;j<=k;++j)
    {
    for(int i=0;i<=a.size()-1;++i)
    {
    if(a[i]=='1')
    {
    for(int w=1;w<=k+1;++w)cout<<" ";

    cout<<"|";

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

    cout<<"|";

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

  • 0
    @ 2017-08-02 03:47:40

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int k;
    int main()
    {
    string a;
    cin>>k;
    cin>>a;
    for(int i=0;i<=a.size()-1;++i)
    {
    if(i==0)cout<<" ";
    if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
    if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
    cout<<" ";
    }
    cout<<endl;
    for(int j=1;j<=k;++j)
    {
    for(int i=0;i<=a.size()-1;++i)
    {
    if(a[i]=='1')
    {
    for(int w=1;w<=k+1;++w)cout<<" ";

    cout<<"|";

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

    cout<<"|";

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

  • 0
    @ 2017-05-26 13:41:13

    最简单代码?

    #include<stdio.h>
    #include<string.h>
    #define p(c) putchar(c)
    const char q[2]={' ','-'};
    const char r[2]={' ','|'};
    const int w[10][3]={{1,0,1},{0,0,0},{1,1,1},{1,1,1},{0,1,0},{1,1,1},{1,1,1},{1,0,0},{1,1,1},{1,1,1}};
    const int u[10][2][2]={{{1,1},{1,1}},{{0,1},{0,1}},{{0,1},{1,0}},{{0,1},{0,1}},{{1,1},{0,1}},
                           {{1,0},{0,1}},{{1,0},{1,1}},{{0,1},{0,1}},{{1,1},{1,1}},{{1,1},{0,1}}};
    void out(char c,int k=1){ while(k--) p(c); }
    int main(){
        int k,n,h=0,l=0; char s[256];
        scanf("%d%s",&k,s); n=strlen(s);
        for(int i=0;i<n;++i) p(' '),out(q[w[s[i]-'0'][h]],k),out(' ',2); p('\n');h++;
        for(int j=0;j<k;++j) {for(int i=0;i<n;++i) p(r[u[s[i]-48][l][0]]),out(' ',k),p(r[u[s[i]-48][l][1]]),p(' '); p('\n');}l++;
        for(int i=0;i<n;++i) p(' '),out(q[w[s[i]-'0'][h]],k),out(' ',2); p('\n');h++;
        for(int j=0;j<k;++j) {for(int i=0;i<n;++i) p(r[u[s[i]-48][l][0]]),out(' ',k),p(r[u[s[i]-48][l][1]]),p(' '); p('\n');}l++;
        for(int i=0;i<n;++i) p(' '),out(q[w[s[i]-'0'][h]],k),out(' ',2); p('\n');h++;
    }
    
    • @ 2017-08-02 03:49:32

      #include<iostream>
      #include<cstdio>
      #include<cstring>
      #include<cmath>
      #include<algorithm>
      using namespace std;
      int k;
      int main()
      {
      string a;
      cin>>k;
      cin>>a;
      for(int i=0;i<=a.size()-1;++i)
      {
      if(i==0)cout<<" ";
      if(a[i]=='1')for(int w=1;w<=k;++w)cout<<" ";
      if(a[i]=='4')for(int w=1;w<=k;++w)cout<<" ";
      if(a[i]!='1'&&a[i]!='4')for(int w=1;w<=k;++w)cout<<"-";
      cout<<" ";
      }
      cout<<endl;
      for(int j=1;j<=k;++j)
      {
      for(int i=0;i<=a.size()-1;++i)
      {
      if(a[i]=='1')
      {
      for(int w=1;w<=k+1;++w)cout<<" ";

      cout<<"|";

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

      cout<<"|";

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

  • 0
    @ 2014-03-18 20:07:56

    var k,i,ii,x,j:longint;s:ansistring;f:array[0..5000,0..5000]of char;
    procedure try1;
    begin
    inc(x);
    for j:=1 to k do begin f[j+1,x]:='|';f[j+k+2,x]:='|';end;
    inc(x);
    end;
    procedure try2;
    begin
    inc(x);
    for j:=1 to k do
    begin f[1,x+j]:='-';f[k+2,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do begin f[j+1,x+k+1]:='|';f[j+k+2,x]:='|';end;
    inc(x,k+2);
    end;
    procedure try3;
    begin
    inc(x);
    for j:=1 to k do
    begin f[1,x+j]:='-';f[k+2,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do begin f[j+1,x+k+1]:='|';f[j+k+2,x+k+1]:='|';end;
    inc(x,k+2);
    end;
    procedure try4;
    begin
    inc(x);
    for j:=1 to k do
    begin f[j+1,x]:='|';f[j+1,x+k+1]:='|';f[j+k+2,x+k+1]:='|';end;
    for j:=1 to k do f[k+2,x+j]:='-';
    inc(x,k+2);
    end;
    procedure try5;
    begin
    inc(x);
    for j:=1 to k do
    begin f[1,x+j]:='-';f[k+2,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do begin f[j+1,x]:='|';f[j+k+2,x+k+1]:='|';end;
    inc(x,k+2);
    end;
    procedure try6;
    begin
    inc(x);
    for j:=1 to k do
    begin f[1,x+j]:='-';f[k+2,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do
    begin f[j+1,x]:='|';f[j+k+2,x]:='|';f[j+k+2,x+k+1]:='|';end;
    inc(x,k+2);
    end;
    procedure try7;
    begin
    inc(x);
    for j:=1 to k do begin f[j+1,x+k]:='|';f[j+k+2,x+k]:='|';end;
    for j:=1 to k do f[1,x+j-1]:='-';
    inc(x,k+1);
    end;
    procedure try8;
    begin
    inc(x);
    for j:=1 to k do
    begin f[1,x+j]:='-';f[k+2,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do
    begin
    f[j+1,x]:='|';f[j+1,x+k+1]:='|';f[j+k+2,x]:='|';
    f[j+k+2,x+k+1]:='|';
    end;
    inc(x,k+2);
    end;
    procedure try9;
    begin
    inc(x);
    for j:=1 to k do
    begin f[1,x+j]:='-';f[k+2,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do
    begin f[j+1,x]:='|';f[j+1,x+k+1]:='|';f[j+k+2,x+k+1]:='|';end;
    inc(x,k+2);
    end;
    procedure try0;
    begin
    inc(x);
    for j:=1 to k do begin f[1,x+j]:='-';f[2*k+3,x+j]:='-';end;
    for j:=1 to k do
    begin
    f[j+1,x]:='|';f[j+1,x+k+1]:='|';f[j+k+2,x]:='|';
    f[j+k+2,x+k+1]:='|';
    end;
    inc(x,k+2);
    end;
    begin
    readln(k);readln(s);x:=1;fillchar(f,sizeof(f),' ');
    for i:=1 to length(s) do
    case s[i] of
    '1':try1;
    '2':try2;
    '3':try3;
    '4':try4;
    '5':try5;
    '6':try6;
    '7':try7;
    '8':try8;
    '9':try9;
    '0':try0;
    end;
    for i:=1 to 2*k+3 do
    begin
    for ii:=1 to x do write(f[i,ii]);
    writeln;
    end;
    end.

  • 0
    @ 2012-09-27 17:38:06

    打表,水

  • 0
    @ 2012-09-25 20:46:07

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    #include

    #include

    using namespace std;

    int main()

    {

    int n;

    cin>>n;

    string s;

    cin>>s;

    int d=s.size();

    for(int i=1; i

  • 0
    @ 2012-09-14 08:40:39

    字模

  • 0
    @ 2012-08-18 12:03:21

    char sz[10][5][3]={{{' ','-',' '},{'|',' ','|'},{' ',' ',' '},{'|',' ','|'},{' ','-',' '}},{{' ',' ',' '},{' ',' ','|'},{' ',' ',' '},{' ',' ','|'},{' ',' ',' '}},{{' ','-',' '},{' ',' ','|'},{' ','-',' '},{'|',' ',' '},{' ','-',' '}},{{' ','-',' '},{' ',' ','|'},{' ','-',' '},{' ',' ','|'},{' ','-',' '}},{{' ',' ',' '},{'|',' ','|'},{' ','-',' '},{' ',' ','|'},{' ',' ',' '}},{{' ','-',' '},{'|',' ',' '},{' ','-',' '},{' ',' ','|'},{' ','-',' '}},{{' ','-',' '},{'|',' ',' '},{' ','-',' '},{'|',' ','|'},{' ','-',' '}},{{' ','-',' '},{' ',' ','|'},{' ',' ',' '},{' ',' ','|'},{' ',' ',' '}},{{' ','-',' '},{'|',' ','|'},{' ','-',' '},{'|',' ','|'},{' ','-',' '}},{{' ','-',' '},{'|',' ','|'},{' ','-',' '},{' ',' ','|'},{' ','-',' '}}};

  • 0
    @ 2010-07-18 00:30:48

    int pic[100][15000]={0};

    int k,end=0,shu;

    #include

    void gao(int n)

    {

    int i;

    if(n==1)

    {

    end++;

    for(i=2;i

  • 0
    @ 2010-07-09 18:09:51

    分段讨论!

    var

    k,i,j,l,n:integer; s:string;

    procedure try1{' -- '};

    begin

    write(' '); for n:=1 to k do write('-'); write(' ');

    end;

    procedure try2{' '};

    begin

    for n:=1 to k+2 do write(' ');

    end;

    procedure try3{' |'};

    begin

    for n:=1 to k+1 do write(' '); write('|');

    end;

    procedure try4{'| '};

    begin

    write('|'); for n:=1 to k+1 do write(' ');

    end;

    procedure try5{'| |'};

    begin

    write('|'); for n:=1 to k do write(' '); write('|');

    end;

    begin

    readln(k); readln(s);

    l:=length(s);

    {1}

    for i:=1 to l do

    begin

    if i>1 then write(' ');

    case s[i] of

    '0','2','3','5','6','7','8','9':try1;

    '1','4':try2;

    end;

    end;

    writeln;

    {2}

    for i:=1 to k do

    begin

    for j:=1 to l do

    begin

    if j>1 then write(' ');

    case s[j] of

    '1','2','3','7':try3;

    '5','6':try4;

    '4','8','9','0':try5;

    end;

    end;

    writeln;

    end;

    {3}

    for i:=1 to l do

    begin

    if i>1 then write(' ');

    case s[i] of

    '2','3','4','5','6','8','9':try1;

    '0','1','7':try2;

    end;

    end;

    writeln;

    {4}

    for i:=1 to k do

    begin

    for j:=1 to l do

    begin

    if j>1 then write(' ');

    case s[j] of

    '1','3','4','5','7','9':try3;

    '2':try4;

    '0','6','8':try5;

    end;

    end;

    writeln;

    end;

    {5}

    for i:=1 to l do

    begin

    if i>1 then write(' ');

    case s[i] of

    '0','2','3','5','6','8','9':try1;

    '1','4','7':try2;

    end;

    end;

    writeln;

    end.

  • 0
    @ 2010-07-08 14:52:28

    各位帮忙看下

    编译通过...

    ├ 测试数据 01:运行超时|格式错误...

    ├ 测试数据 02:运行超时|格式错误...

    ├ 测试数据 03:运行超时|格式错误...

    ├ 测试数据 04:运行超时|格式错误...

    ├ 测试数据 05:运行超时|格式错误...

    ├ 测试数据 06:运行超时|格式错误...

    ├ 测试数据 07:运行超时|格式错误...

    ├ 测试数据 08:运行超时|格式错误...

    ├ 测试数据 09:运行超时|格式错误...

    ├ 测试数据 10:运行超时|格式错误...

    ---|---|---|---|---|---|---|---|-

    Unaccepted 有效得分:0 有效耗时:0ms

    program t_1064;

    const f:array[1..7,0..9]of 0..1=((1,0,1,1,0,1,1,1,1,1),

    (1,0,0,0,1,1,1,0,1,1),

    (1,1,1,1,1,0,0,1,1,1),

    (0,0,1,1,1,1,1,0,1,1),

    (1,0,1,0,0,0,1,0,1,0),

    (1,1,0,1,1,1,1,1,1,1),

    (1,0,1,1,0,1,1,0,1,1));

    var i,j,k,n,m:byte;

    s:string;

    a:array[1..256]of 0..9;

    begin

    readln(k);

    readln(s);

    n:=length(s);

    for i:=1 to n do a[i]:=ord(s[i])-ord('0');

    for i:=1 to n do begin

    if i=1 then write(' ') else write(' ');

    if f[1,a[i]]=1then

    for j:=1 to k do write('-')

    else for j:=1 to k do write(' ');

    end;

    writeln;

    for j:=1 to k do begin

    for i:=1 to n do begin

    if i1 then write(' ');

    if f[2,a[i]]=1 then write('|')

    else write(' ');

    for m:=1 to k do write(' ');

    if f[3,a[i]]=1 then write('|')

    else write(' ');

    end;

    writeln;

    end;

    for i:=1 to n do begin

    if i=1 then write(' ') else write(' ');

    if f[4,a[i]]=1then

    for j:=1 to k do write('-')

    else for j:=1 to k do write(' ');

    end;

    writeln;

    for j:=1 to k do begin

    for i:=1 to n do begin

    if i1 then write(' ');

    if f[5,a[i]]=1 then write('|')

    else write(' ');

    for m:=1 to k do write(' ');

    if f[6,a[i]]=1 then write('|')

    else write(' ');

    end;

    writeln;

    end;

    for i:=1 to n do begin

    if i=1 then write(' ') else write(' ');

    if f[7,a[i]]=1then

    for j:=1 to k do write('-')

    else for j:=1 to k do write(' ');

    end;

    writeln;

    end.

  • 0
    @ 2010-04-05 19:56:13

    var

    n,l,k,i,j:integer;

    s:string;

    begin

    readln(n);

    readln(s);

    l:=length(s);

    for i:=1 to 2*n+3 do begin

    for j:=1 to length(s) do begin

    if j1 then write(' ');

    if i=1 then begin

    write(' ');

    if s[j] in ['2','3','5','6','7','8','9','0'] then begin

    for k:=1 to n do write('-');

    end else begin

    if s[j] in ['4','1'] then for k:=1 to n do write(' ');

    end;

    write(' ');

    end;

    if (i>=2) and (i=n+3) and (i

信息

ID
1064
难度
4
分类
字符串 点击显示
标签
递交数
1886
已通过
819
通过率
43%
被复制
10
上传者