結果

問題 No.150 "良問"(良問とは言っていない
ユーザー haraduka_haraduka_
提出日時 2015-02-13 19:09:08
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,087 ms / 5,000 ms
コード長 734 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-04-19 09:21:28
合計ジャッジ時間 5,447 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 222 ms
6,272 KB
testcase_01 AC 11 ms
6,272 KB
testcase_02 AC 11 ms
6,144 KB
testcase_03 AC 10 ms
6,272 KB
testcase_04 AC 11 ms
6,272 KB
testcase_05 AC 21 ms
6,400 KB
testcase_06 AC 1,087 ms
6,272 KB
testcase_07 AC 10 ms
6,272 KB
testcase_08 AC 15 ms
6,400 KB
testcase_09 AC 12 ms
6,272 KB
testcase_10 AC 253 ms
6,400 KB
testcase_11 AC 286 ms
6,272 KB
testcase_12 AC 192 ms
6,272 KB
testcase_13 AC 273 ms
6,272 KB
testcase_14 AC 346 ms
6,272 KB
testcase_15 AC 334 ms
6,272 KB
testcase_16 AC 35 ms
6,272 KB
testcase_17 AC 104 ms
6,272 KB
testcase_18 AC 313 ms
6,272 KB
testcase_19 AC 381 ms
6,400 KB
testcase_20 AC 400 ms
6,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())

words = []
for i in range(N):
    words.append(raw_input())

good = "good"
problem = "problem"
for k in range(N):
    res = 1000
    for i in range(len(words[k])):
        rtmp = 0
        if i+len(good) > len(words[k]):
            continue
        for j in range(len(good)):
            if words[k][i+j] != good[j]:
                rtmp += 1

        for ii in range(i+len(good), len(words[k])):
            tmp = rtmp
            if ii+len(problem) > len(words[k]):
                continue
            for j in range(len(problem)):
                if words[k][ii+j] != problem[j]:
                    tmp += 1

            res = min(res, tmp)
    if res == 1000:
        print 0
    else:
        print res
0