QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#39646#2942. 7 Segments You Say?EkeWA 10ms13696kbC++3.4kb2022-07-12 17:27:082022-07-12 17:27:10

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-12 17:27:10]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:13696kb
  • [2022-07-12 17:27:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn = 114514;
int s;
string str;
char output[maxn][90];
bool v[maxn];
int main()
{
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    memset(output, 0, sizeof(output));
    cin >> s >> str;
    int r = 0, c = 0;
    while (str.size() % 7) {
        str = '0' + str;
    }
    for (int i = 0; i + 7 <= str.size(); i += 7) {
        for (int i = r; i < r + s * 7; ++i) v[i] = 1;
        for (int i = r; i < r + s * 7; ++i) {
                for (int j = c; j < c + s * 3; ++j) output[i][j] = ' ';
            }
        string sub = str.substr(i, 7);
        if (sub != "1110111" && sub != "0100100" && sub != "1011101" && sub != "1101101"
        && sub != "0101110" && sub != "1101011" && sub != "1111011" && sub != "0100101"
        && sub != "1111111" && sub != "1101111" && sub != "0111111" && sub != "1111010"
        && sub != "1010011" && sub != "1111100" && sub != "1011011" && sub != "0011011") {
            for (int j = r; j < r + 7 * s; ++j) {
                for (int k = c; k < c + 3 * s; ++k) {
                    output[j][k] = ' ';
                }
            }
            goto L;
        }
        if (str[i + 6] == '1') {
            for (int j = r; j < r + s; ++j) {
                for (int k = c; k < c + s * 3; ++k) {
                    output[j][k] = 'X';
                }
            }
        }
        if (str[i + 5] == '1') {
            for (int j = r + s; j < r + s * 3; ++j) {
                for (int k = c; k < c + s; ++k) {
                    output[j][k] = 'X';
                }
            }
        }
        if (str[i + 4] == '1') {
            for (int j = r + s; j < r + s * 3; ++j) {
                for (int k = c + s * 2; k < c + s * 3; ++k) {
                    output[j][k] = 'X';
                }
            }
        }
        if (str[i + 3] == '1') {
            for (int j = r + 3 * s; j < r + 4 * s; ++j) {
                for (int k = c; k < c + s * 3; ++ k) {
                    output[j][k] = 'X';
                }
            }
        }
        if (str[i + 2] == '1') {
            for (int j = r + 4 * s; j < r + 6 * s; ++j) {
                for (int k = c; k < c + s; ++k) {
                    output[j][k] = 'X';
                }
            }
        }
        if (str[i + 1] == '1') {
            for (int j = r + 4 * s; j < r + 6 * s; ++j) {
                for (int k = c + s * 2; k < c + s * 3; ++k) {
                    output[j][k] = 'X';
                }
            }
        }
        if (str[i] == '1') {
            for (int j = r + 6 * s; j < r + 7 * s; ++j) {
                for (int k = c; k < c + s * 3; ++k) {
                    output[j][k] = 'X';
                }
            }
        }
        L:
        if (c + s * 5 >= 80) {
            c = 0;
            for (int j = r + 7 * s; j < r + 8 * s; ++j) {
                output[j][0] = '\0';
                v[j] = 1;
            }
            r += 8 * s;
            continue;
        }
        if (i + 14 <= str.size())
        for (int j = r; j < r + 7 * s; ++j) {
            for (int k = c + s * 3; k < c + s * 5; ++k) {
                output[j][k] = ' ';
            }
        }
        c += s * 5;
    }
    int ptr = maxn - 2;
    while (output[ptr][0] == '\0') ptr--;
    for (int i = 0; i < ptr; ++i) {
        cout << output[i] << endl;
    }
    cout << output[ptr];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 13696kb

input:

1 110111111011

output:

XXX  XXX
X    X  
X    X  
XXX  XXX
X    X X
X    X X
     XXX

result:

ok 7 lines

Test #2:

score: 0
Accepted
time: 7ms
memory: 13576kb

input:

4 110111111011

output:

XXXXXXXXXXXX        XXXXXXXXXXXX
XXXXXXXXXXXX        XXXXXXXXXXXX
XXXXXXXXXXXX        XXXXXXXXXXXX
XXXXXXXXXXXX        XXXXXXXXXXXX
XXXX                XXXX        
XXXX                XXXX        
XXXX                XXXX        
XXXX                XXXX        
XXXX                XXXX        
XXX...

result:

ok 28 lines

Test #3:

score: 0
Accepted
time: 3ms
memory: 13664kb

input:

1 1110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011

output:

XXX       XXX  XXX       XXX  XXX  XXX  XXX  XXX  XXX       XXX       XXX  XXX
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  
          XXX  XXX  XXX  XXX  XXX       XXX  XXX  XXX  XXX     ...

result:

ok 7 lines

Test #4:

score: 0
Accepted
time: 10ms
memory: 13668kb

input:

1 111011101001001011101110110101011101101011111101101001011111111110111101111111111010101001111111001011011001101111101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101

output:

XXX       XXX  XXX       XXX  XXX  XXX  XXX  XXX  XXX       XXX       XXX  XXX
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  
          XXX  XXX  XXX  XXX  XXX       XXX  XXX  XXX  XXX     ...

result:

ok 23 lines

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 13652kb

input:

3 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011

output:

XXXXXXXXX                     XXXXXXXXX      XXXXXXXXX                     XXXXXXXXX
XXXXXXXXX                     XXXXXXXXX      XXXXXXXXX                     XXXXXXXXX
XXXXXXXXX                     XXXXXXXXX      XXXXXXXXX                     XXXXXXXXX
XXX   XXX            XXX            XXX      ...

result:

wrong answer 1st lines differ - expected: 'XXXXXXXXX                     ...X      XXXXXXXXX               ', found: 'XXXXXXXXX                     ...X                     XXXXXXXXX'