結果

問題 No.150 "良問"(良問とは言っていない
ユーザー steek79steek79
提出日時 2015-10-14 21:01:59
言語 Python2
(2.7.18)
結果
AC  
実行時間 956 ms / 5,000 ms
コード長 367 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 09:27:40
合計ジャッジ時間 4,769 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 195 ms
6,812 KB
testcase_01 AC 11 ms
6,944 KB
testcase_02 AC 11 ms
6,944 KB
testcase_03 AC 10 ms
6,944 KB
testcase_04 AC 10 ms
6,940 KB
testcase_05 AC 20 ms
6,940 KB
testcase_06 AC 956 ms
6,944 KB
testcase_07 AC 11 ms
6,944 KB
testcase_08 AC 15 ms
6,940 KB
testcase_09 AC 12 ms
6,940 KB
testcase_10 AC 222 ms
6,944 KB
testcase_11 AC 251 ms
6,940 KB
testcase_12 AC 169 ms
6,940 KB
testcase_13 AC 237 ms
6,940 KB
testcase_14 AC 303 ms
6,940 KB
testcase_15 AC 291 ms
6,940 KB
testcase_16 AC 31 ms
6,940 KB
testcase_17 AC 90 ms
6,944 KB
testcase_18 AC 273 ms
6,944 KB
testcase_19 AC 332 ms
6,940 KB
testcase_20 AC 350 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def diff(str1, str2):
    cnt = 0
    for i in range(len(str1)):
        if str1[i] != str2[i]:
            cnt += 1
    return cnt

T = input()
for t in range(T):
    S = raw_input()
    ans = 12
    for i in range(len(S)-3):
        for j in range(i+4, len(S)-6):
            ans = min(ans, diff(S[i:i+4], 'good') + diff(S[j:j+7], 'problem'))
        
    print ans
0