結果

問題 No.150 "良問"(良問とは言っていない
ユーザー kohei2019kohei2019
提出日時 2021-08-07 19:01:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 468 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,300 KB
実行使用メモリ 75,756 KB
最終ジャッジ日時 2023-10-18 23:38:59
合計ジャッジ時間 2,930 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
75,668 KB
testcase_01 AC 39 ms
53,216 KB
testcase_02 AC 37 ms
53,216 KB
testcase_03 AC 37 ms
53,216 KB
testcase_04 AC 36 ms
53,216 KB
testcase_05 AC 54 ms
68,252 KB
testcase_06 AC 156 ms
75,696 KB
testcase_07 AC 37 ms
53,216 KB
testcase_08 AC 50 ms
64,112 KB
testcase_09 AC 44 ms
58,964 KB
testcase_10 AC 86 ms
75,560 KB
testcase_11 AC 93 ms
75,620 KB
testcase_12 AC 84 ms
75,536 KB
testcase_13 AC 92 ms
75,648 KB
testcase_14 AC 99 ms
75,596 KB
testcase_15 AC 98 ms
75,544 KB
testcase_16 AC 60 ms
73,388 KB
testcase_17 AC 77 ms
75,592 KB
testcase_18 AC 94 ms
75,448 KB
testcase_19 AC 101 ms
75,756 KB
testcase_20 AC 100 ms
75,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
lsS = [input() for i in range(T)]
s1 = 'good'
s2 = 'problem'

def unmatch(s0,sa):
    cnt = 0
    for i in range(len(s0)):
        if s0[i] != sa[i]:
            cnt += 1
    return cnt

for i in range(T):
    s = lsS[i]
    score0 = 11
    for k in range(len(s)-10):
        score1 = unmatch(s1,s[k:k+4])
        for l in range(k+4,len(s)-6):
            score2 = unmatch(s2,s[l:l+7])
            score0 = min(score1+score2,score0)
    print(score0)
0