#34475:


11131039@stu.tshs.tp.edu.tw (二孝25林孟希)

學校 : 不指定學校
編號 : 201083
來源 : [36.227.70.244]
最後登入時間 :
2024-05-22 06:16:38
c135. 00706 - LC-Display -- UVa706 | From: [36.225.121.214] | 發表日期 : 2023-03-22 21:18

#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
    int s;
    string n;
    while(cin>>s>>n)
    {
        if(s==0 && n=="0")
        {
            break;
        }
        int l=n.length();
        //重複字串長度次
        for(int i=0;i<l;i++)
        {
            if(n[i]=='1' || n[i]=='4')
            {
                for(int j=0;j<s+2;j++)
                {
                    cout<<" ";
                }
            }
            else if(n[i]=='0' || n[i]=='2' || n[i]=='3' || n[i]=='5' || n[i]=='6' || n[i]=='7' || n[i]=='8' || n[i]=='9')
            {
                cout<<" ";
                for(int j=0;j<s;j++)
                {
                    cout<<"-";
                }
                cout<<" ";
            }
            cout<<" ";
        }
        cout<<endl;
        //重複s次,其中每一次皆為字串長度次
        for(int j=0;j<s;j++)
        {
            for(int i=0;i<l;i++)
            {
                if(n[i]=='0' || n[i]=='4' || n[i]=='8' || n[i]=='9')
                {
                    cout<<"|";
                    for(int k=0;k<s;k++)
                    {
                        cout<<" ";
                    }
                    cout<<"|";
                }
                else if(n[i]=='1' || n[i]=='2' || n[i]=='3' || n[i]=='7')
                {
                    for(int k=0;k<s+1;k++)
                    {
                        cout<<" ";
                    }
                    cout<<"|";
                }
                else if(n[i]=='5' || n[i]=='6')
                {
                    cout<<"|";
                    for(int k=0;k<s+1;k++)
                    {
                        cout<<" ";
                    }
                }
                cout<<" ";
            }
            cout<<endl;
        }
        //重複字串長度次
        for(int i=0;i<l;i++)
        {
            if(n[i]=='0' || n[i]=='1' || n[i]=='7')
            {
                for(int j=0;j<s+2;j++)
                {
                    cout<<" ";
                }
            }
            else if(n[i]=='2' || n[i]=='3' || n[i]=='4' || n[i]=='5' || n[i]=='6' || n[i]=='8' || n[i]=='9')
            {
                cout<<" ";
                for(int j=0;j<s;j++)
                {
                    cout<<"-";
                }
                cout<<" ";
            }
            cout<<" ";
        }
        cout<<endl;
        //重複s次,其中每一次皆為字串長度次
        for(int j=0;j<s;j++)
        {
            for(int i=0;i<l;i++)
            {
                if(n[i]=='0' || n[i]=='6' || n[i]=='8')
                {
                    cout<<"|";
                    for(int k=0;k<s;k++)
                    {
                        cout<<" ";
                    }
                    cout<<"|";
                }
                else if(n[i]=='1' || n[i]=='3' || n[i]=='4' || n[i]=='5' || n[i]=='7' || n[i]=='9')
                {
                    for(int k=0;k<s+1;k++)
                    {
                        cout<<" ";
                    }
                    cout<<"|";
                }
                else if(n[i]=='2')
                {
                    cout<<"|";
                    for(int k=0;k<s+1;k++)
                    {
                        cout<<" ";
                    }
                }
                cout<<" ";
            }
            cout<<endl;
        }
        //重複字串長度次
        for(int i=0;i<l;i++)
        {
            if(n[i]=='0' || n[i]=='2' || n[i]=='3' || n[i]=='5' || n[i]=='6' || n[i]=='8' || n[i]=='9')
            {
                cout<<" ";
                for(int j=0;j<s;j++)
                {
                    cout<<"-";
                }
                cout<<" ";
            }
            else if(n[i]=='1' || n[i]=='4' || n[i]=='7')
            {
                for(int j=0;j<s+2;j++)
                {
                    cout<<" ";
                }
            }
            cout<<" ";
        }
        cout<<endl;
        cout<<endl;
    }
}
/*
                                                0     1     2     3     4     5     6     7    8    9
 -       -   -       -   -   -   -   -    010 000 010 010 000 010 010 010 010 010 => 1,4:000            // 0,2,3,5,6,7,8,9:010                  重複字串長度次
| |   |   |   | | | |   |     | | | | |        101 001 001 001 101 100 100 001 101 101 => 0,4,8,9:101        // 1,2,3,7:001         // 5,6:100    重複s次,其中每一次皆為字串長度次
         -   -   -   -   -       -   -    000 000 010 010 010 010 010 000 010 010 => 0,1,7:000          // 2,3,4,5,6,8,9:010                     重複字串長度次
| |   | |     |   |   | | |   | | |   |        101 001 100 001 001 001 101 001 101 001 => 0,6,8:101           // 1,3,4,5,7,9:001     // 2:100     重複s次,其中每一次皆為字串長度次
 -       -   -       -   -       -   -    010 000 010 010 000 010 010 000 010 010 => 0,2,3,5,6,8,9:010    // 1,4,7:000                           重複字串長度次
*/
 
ZeroJudge Forum