QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#84108#5671. Programmable VirusmaspyAC ✓17ms8044kbPython31019b2023-03-05 15:31:012023-03-05 15:31:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-05 15:31:02]
  • 评测
  • 测评结果:AC
  • 用时:17ms
  • 内存:8044kb
  • [2023-03-05 15:31:01]
  • 提交

answer

words = {
    '0': "CCC",
    '>': "ACG",
    '<': "UGA",
    '+': "UGC",
    '-': "UAC",
    '.': "GCG",
    ',': "UCC",
    '[': "AGG",
    ']': "UGU",
    '9': "CAC"
}


def convert(S):
    return "".join(words[x] for x in S)


def solve(p):
    # divmod
    X = ">" + ("+" * p) + "<[>->+<[>]>[<+>-]<<[<]>-]>[-]>[-<<+>>]<<"
    # B は、[1,>x,y] のときに [1,>10x+y] にする
    # B = C + D + E
    # C は、[1,>x,y,0,0] のときに [1,>0,y,0,10x] にする
    # D は [1,>0,y,0,10x] のときに [1,>0,0,0,10x+y] にする
    E = ">>>[-<<<+>>>]<<<"
    D = ">[->>+" + X + "<<]<"
    C = "[->>>" + 10 * ("+" + X) + "<<<]"
    B = C + D + E
    # ANS = f"+[>{A}<]"
    # [1,>x] のときに、[1,>10x+y] にするのが A
    # [1,x,>y,1] にしたあと、y=0 以外はポインタをずらす
    A = ">,9>+<+" + "[>>]>[<<[[-].0]+.0]" + "<<-<-<" + B
    ANS = f"+[9>{A}<]"

    ANS = ANS.replace("9", "")
    return convert(ANS)


n = int(input())
print(solve(n))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 7964kb

input:

1

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACG...

result:

ok correct

Test #2:

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

input:

2

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGA...

result:

ok correct

Test #3:

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

input:

3

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACG...

result:

ok correct

Test #4:

score: 0
Accepted
time: 5ms
memory: 7972kb

input:

6

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACG...

result:

ok correct

Test #5:

score: 0
Accepted
time: 11ms
memory: 7968kb

input:

1

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACG...

result:

ok correct

Test #6:

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

input:

2

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGA...

result:

ok correct

Test #7:

score: 0
Accepted
time: 12ms
memory: 7952kb

input:

3

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACG...

result:

ok correct

Test #8:

score: 0
Accepted
time: 11ms
memory: 7968kb

input:

4

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACG...

result:

ok correct

Test #9:

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

input:

5

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGA...

result:

ok correct

Test #10:

score: 0
Accepted
time: 17ms
memory: 8004kb

input:

6

output:

UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACG...

result:

ok correct