QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#59502#3491. Meow Factor 2yahocoCompile Error//Python3511b2022-10-29 19:30:372022-10-29 19:30:38

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-29 19:30:38]
  • 评测
  • [2022-10-29 19:30:37]
  • 提交

answer

P = 'meow'
S = raw_input()
n = len(S)
opt = [i % 5 for i in range(5*(n+1))]
ans = 4
for i in range(n):
    for j in range(4):
        opt[5*(i+1)+j+1] = min(opt[5*i+j+1] + 1, # del
                               opt[5*(i+1)+j] + 1, # ins
                               opt[5*i+j] + (S[i] != P[j])) # sub
        if i > 0 and j > 0 and S[i] == P[j-1] and S[i-1] == P[j]: # swap
            opt[5*(i+1)+j+1] = min(opt[5*(i+1)+j+1], 1 + opt[5*(i-1)+j-1])
    ans = min(ans, opt[5*(i+1)+4])
print ans

Details

  File "answer.code", line 14
    print ans
            ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(ans)?