QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#73221#2942. 7 Segments You Say?qdd#WA 20ms8132kbPython32.9kb2023-01-23 06:31:212023-01-23 06:31:23

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-23 06:31:23]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:8132kb
  • [2023-01-23 06:31:21]
  • 提交

answer

from math import ceil

s, allinput = input().split()
s = int(s)

if len(allinput) % 7 != 0:
    allinput = "0" * (7 - len(allinput) % 7) + allinput

charspersymbol = s * 5
symbolsperline = (80 + s * 2) // charspersymbol

formatted = []
for i in range(len(allinput) // 7):
    formatted.append(allinput[7 * i:7 * i + 7])

totallines = ceil(len(formatted) / symbolsperline)
for lines in range(totallines):
    top = ""

    if lines == totallines - 1:
        sizecurrline = len(formatted) % symbolsperline
        if sizecurrline == 0:
            sizecurrline = symbolsperline
    else:
        sizecurrline = symbolsperline

    for i in range(symbolsperline):
        if i + lines * symbolsperline >= len(formatted):
            break

        if formatted[i + lines * symbolsperline][6] == "1":
            top += "X" * 3 * s
        else:
            top += " " * 3 * s

        if i < sizecurrline - 1:
            top += " " * 2 * s
    for i in range(s):
        print(top)

    vert1 = ""
    for i in range(sizecurrline):
        if i + lines * symbolsperline >= len(formatted):
            break

        if formatted[i + lines * symbolsperline][5] == "1":
            vert1 += "X" * s
        else:
            vert1 += " " * s

        vert1 += " " * s

        if formatted[i + lines * symbolsperline][4] == "1":
            vert1 += "X" * s
        else:
            vert1 += " " * s

        if i < sizecurrline - 1:
            vert1 += " " * 2 * s

    for i in range(s * 2):
        print(vert1)

    mid = ""
    for i in range(sizecurrline):
        if i + lines * symbolsperline >= len(formatted):
            break

        if formatted[i + lines * symbolsperline][3] == "1":
            mid += "X" * 3 * s
        else:
            mid += " " * 3 * s

        if i < sizecurrline - 1:
            mid += " " * 2 * s
    for i in range(s):
        print(mid)

    vert2 = ""
    for i in range(sizecurrline):
        if i + lines * symbolsperline >= len(formatted):
            break

        if formatted[i + lines * symbolsperline][2] == "1":
            vert2 += "X" * s
        else:
            vert2 += " " * s

        vert2 += " " * s

        if formatted[i + lines * symbolsperline][1] == "1":
            vert2 += "X" * s
        else:
            vert2 += " " * s

        if i < sizecurrline - 1:
            vert2 += " " * 2 * s

    for i in range(s * 2):
        print(vert2)

    bot = ""
    for i in range(sizecurrline):
        if i + lines * symbolsperline >= len(formatted):
            break

        if formatted[i + lines * symbolsperline][0] == "1":
            bot += "X" * 3 * s
        else:
            bot += " " * 3 * s

        if i < sizecurrline - 1:
            bot += " " * 2 * s
    for i in range(s):
        print(bot)

    if lines < totallines - 1:
        for i in range(s):
            print()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 12ms
memory: 8124kb

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: 8056kb

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: 18ms
memory: 7956kb

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: 20ms
memory: 8060kb

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: 0
Accepted
time: 13ms
memory: 8132kb

input:

3 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011

output:

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

result:

ok 165 lines

Test #6:

score: 0
Accepted
time: 2ms
memory: 8076kb

input:

8 11101110100100101110111011010101110110101111110110100101111111111011110111111111101010100111111100101101100110111110111010010010111011101101010111011010111111011010010111111111101111011111111110101010011111110010110110011011

output:

XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                                        
XXXXXXXXXXXXXXXXXXXXXXXX                ...

result:

ok 1016 lines

Test #7:

score: 0
Accepted
time: 13ms
memory: 8008kb

input:

1 1111111

output:

XXX
X X
X X
XXX
X X
X X
XXX

result:

ok 7 lines

Test #8:

score: -100
Wrong Answer
time: 11ms
memory: 8048kb

input:

1 0101011

output:

XXX
X  
X  
XXX
  X
  X
   

result:

wrong answer 1st lines differ - expected: '   ', found: 'XXX'