結果

問題 No.150 "良問"(良問とは言っていない
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-01 11:56:42
言語 Python2
(2.7.18)
結果
AC  
実行時間 890 ms / 5,000 ms
コード長 412 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 6,784 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2024-04-19 09:25:14
合計ジャッジ時間 4,820 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 177 ms
6,144 KB
testcase_01 AC 11 ms
6,144 KB
testcase_02 AC 10 ms
6,016 KB
testcase_03 AC 13 ms
6,016 KB
testcase_04 AC 10 ms
6,016 KB
testcase_05 AC 20 ms
6,144 KB
testcase_06 AC 890 ms
6,144 KB
testcase_07 AC 12 ms
6,144 KB
testcase_08 AC 13 ms
6,016 KB
testcase_09 AC 11 ms
6,144 KB
testcase_10 AC 202 ms
6,144 KB
testcase_11 AC 245 ms
6,144 KB
testcase_12 AC 165 ms
6,144 KB
testcase_13 AC 235 ms
6,016 KB
testcase_14 AC 288 ms
6,144 KB
testcase_15 AC 267 ms
6,144 KB
testcase_16 AC 29 ms
6,144 KB
testcase_17 AC 83 ms
6,016 KB
testcase_18 AC 257 ms
6,144 KB
testcase_19 AC 304 ms
6,144 KB
testcase_20 AC 311 ms
6,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def dif(s,t):
    ret=0
    for i in range(len(s)):
        if( s[i]!=t[i]):
            ret+=1
    return ret

T=int(raw_input())
for i in range(T):
    S=raw_input()
    size=len(S)
    ans=100
    for i in range(size):
        for j in range(i+4,size-6):
            tmpans=dif(S[i:i+4],"good")+dif(S[j:j+7],"problem")
            #print S[i:i+4],S[j:j+7],tmpans
            ans=min(ans,tmpans)
    print ans
0