非常恐怖,兄dei

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

希阳iiiii @ 2021-04-23 20:28:07

#include<iostream>
#include<string>
using namespace std;

int main()
{
    //显示屏
    int n;
    cin >> n;

    string st,s1,s2,s3,s4,s5;
    s1 = s2 = s3 = s4 = s5 = "";
    cin >> st;
    for (int i = 0; i < st.size(); i++)
    {
        if (i != st.size() - 1) {
            if (st[i] - '0' == 0) {
                s1 += "XXX."; s2 += "X.X."; s3 += "X.X."; s4 += "X.X."; s5 += "XXX.";
            }
            if (st[i] - '0' == 1) {
                s1 += "..X."; s2 += "..X."; s3 += "..X."; s4 += "..X."; s5 += "..X.";
            }
            if (st[i] - '0' == 2) {
                s1 += "XXX."; s2 += "..X."; s3 += "XXX."; s4 += "X..."; s5 += "XXX.";
            }
            if (st[i] - '0' == 3) {
                s1 += "XXX."; s2 += "..X."; s3 += "XXX."; s4 += "..X."; s5 += "XXX.";
            }
            if (st[i] - '0' == 4) {
                s1 += "X.X."; s2 += "X.X."; s3 += "XXX.";s4 += "..X.";s5 += "..X.";
            }
            if (st[i] - '0' == 5) {
                s1 += "XXX."; s2 += "X..."; s3 += "XXX."; s4 += "..X."; s5 += "XXX.";
            }
            if (st[i] - '0' == 6) {
                s1 += "XXX."; s2 += "X..."; s3 += "XXX."; s4 += "X.X."; s5 += "XXX.";
            }
            if (st[i] - '0' == 7) {
                s1 += "XXX."; s2 += "..X."; s3 += "..X."; s4 += "..X."; s5 += "..X.";
            }
            if (st[i] - '0' == 8) {
                s1 += "XXX."; s2 += "X.X."; s3 += "XXX."; s4 += "X.X."; s5 += "XXX.";
            }
            if (st[i] - '0' == 9) {
                s1 += "XXX."; s2 += "X.X."; s3 += "XXX."; s4 += "..X."; s5 += "XXX.";
            }
        }
        else
        {
            if (st[i] - '0' == 0) {
                s1 += "XXX"; s2 += "X.X"; s3 += "X.X"; s4 += "X.X"; s5 += "XXX";
            }
            if (st[i] - '0' == 1) {
                s1 += "..X"; s2 += "..X"; s3 += "..X"; s4 += "..X"; s5 += "..X";
            }
            if (st[i] - '0' == 2) {
                s1 += "XXX"; s2 += "..X"; s3 += "XXX"; s4 += "X.."; s5 += "XXX";
            }
            if (st[i] - '0' == 3) {
                s1 += "XXX"; s2 += "..X"; s3 += "XXX"; s4 += "..X"; s5 += "XXX";
            }
            if (st[i] - '0' == 4) {
                s1 += "X.X"; s2 += "X.X"; s3 += "XXX"; s4 += "..X"; s5 += "..X";
            }
            if (st[i] - '0' == 5) {
                s1 += "XXX"; s2 += "X.."; s3 += "XXX"; s4 += "..X"; s5 += "XXX";
            }
            if (st[i] - '0' == 6) {
                s1 += "XXX"; s2 += "X.."; s3 += "XXX"; s4 += "X.X"; s5 += "XXX";
            }
            if (st[i] - '0' == 7) {
                s1 += "XXX"; s2 += "..X"; s3 += "..X"; s4 += "..X"; s5 += "..X";
            }
            if (st[i] - '0' == 8) {
                s1 += "XXX"; s2 += "X.X"; s3 += "XXX"; s4 += "X.X"; s5 += "XXX";
            }
            if (st[i] - '0' == 9) {
                s1 += "XXX"; s2 += "X.X"; s3 += "XXX"; s4 += "..X"; s5 += "XXX";
            }
        }   
    }

    cout << s1 << endl << s2 << endl << s3 << endl << s4 << endl << s5;
    return 0;
}

by 天南星魔芋 @ 2021-04-23 20:45:36

是的,你的码量非常恐怖。


by 天南星魔芋 @ 2021-04-23 20:45:53

tlqtj


|