結果

問題 No.150 "良問"(良問とは言っていない
ユーザー steek79steek79
提出日時 2015-10-14 21:01:59
言語 Python2
(2.7.18)
結果
AC  
実行時間 883 ms / 5,000 ms
コード長 367 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 6,196 KB
最終ジャッジ日時 2023-08-01 09:56:23
合計ジャッジ時間 5,091 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
6,048 KB
testcase_01 AC 11 ms
6,132 KB
testcase_02 AC 11 ms
5,972 KB
testcase_03 AC 11 ms
6,056 KB
testcase_04 AC 12 ms
6,004 KB
testcase_05 AC 21 ms
6,052 KB
testcase_06 AC 883 ms
6,056 KB
testcase_07 AC 11 ms
6,136 KB
testcase_08 AC 15 ms
6,048 KB
testcase_09 AC 12 ms
6,048 KB
testcase_10 AC 206 ms
5,988 KB
testcase_11 AC 236 ms
6,028 KB
testcase_12 AC 158 ms
6,036 KB
testcase_13 AC 222 ms
5,976 KB
testcase_14 AC 283 ms
6,124 KB
testcase_15 AC 270 ms
5,964 KB
testcase_16 AC 30 ms
6,060 KB
testcase_17 AC 83 ms
6,064 KB
testcase_18 AC 250 ms
6,012 KB
testcase_19 AC 306 ms
6,196 KB
testcase_20 AC 323 ms
6,052 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