結果

問題 No.150 "良問"(良問とは言っていない
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-12 09:01:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 201 ms / 5,000 ms
コード長 429 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 86,616 KB
実行使用メモリ 78,156 KB
最終ジャッジ日時 2023-09-28 00:22:50
合計ジャッジ時間 4,271 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
77,564 KB
testcase_01 AC 62 ms
71,052 KB
testcase_02 AC 59 ms
71,304 KB
testcase_03 AC 60 ms
71,180 KB
testcase_04 AC 61 ms
71,060 KB
testcase_05 AC 76 ms
76,296 KB
testcase_06 AC 201 ms
78,156 KB
testcase_07 AC 63 ms
71,196 KB
testcase_08 AC 73 ms
76,232 KB
testcase_09 AC 70 ms
75,292 KB
testcase_10 AC 105 ms
77,116 KB
testcase_11 AC 112 ms
77,428 KB
testcase_12 AC 103 ms
77,092 KB
testcase_13 AC 112 ms
77,448 KB
testcase_14 AC 117 ms
77,864 KB
testcase_15 AC 119 ms
77,428 KB
testcase_16 AC 80 ms
77,268 KB
testcase_17 AC 96 ms
77,048 KB
testcase_18 AC 114 ms
77,212 KB
testcase_19 AC 131 ms
76,904 KB
testcase_20 AC 128 ms
77,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ham(s1, s2):
    res = 0
    for c1,c2 in zip(s1, s2):
        if c1 != c2:
            res += 1
    return res

t = int(input())
for _ in range(t):
    s = str(input())
    n = len(s)
    ans = 11
    for i in range(n):
        u = s[i:i+4]
        temp1 = ham(u, 'good')
        for j in range(i+4, n-6):
            v = s[j:j+7]
            temp2 = ham(v, 'problem')
            ans = min(ans, temp1+temp2)
    print(ans)
0