結果

問題 No.150 "良問"(良問とは言っていない
ユーザー nebukuro09nebukuro09
提出日時 2016-11-01 10:45:14
言語 Python2
(2.7.18)
結果
AC  
実行時間 275 ms / 5,000 ms
コード長 462 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-04-19 09:41:43
合計ジャッジ時間 2,235 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
6,528 KB
testcase_01 AC 11 ms
6,272 KB
testcase_02 AC 10 ms
6,528 KB
testcase_03 AC 11 ms
6,400 KB
testcase_04 AC 11 ms
6,400 KB
testcase_05 AC 13 ms
6,400 KB
testcase_06 AC 275 ms
6,400 KB
testcase_07 AC 11 ms
6,272 KB
testcase_08 AC 12 ms
6,400 KB
testcase_09 AC 11 ms
6,528 KB
testcase_10 AC 71 ms
6,528 KB
testcase_11 AC 80 ms
6,528 KB
testcase_12 AC 55 ms
6,400 KB
testcase_13 AC 75 ms
6,528 KB
testcase_14 AC 94 ms
6,400 KB
testcase_15 AC 90 ms
6,528 KB
testcase_16 AC 17 ms
6,400 KB
testcase_17 AC 33 ms
6,400 KB
testcase_18 AC 85 ms
6,400 KB
testcase_19 AC 103 ms
6,528 KB
testcase_20 AC 106 ms
6,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    S = raw_input()
    ans = float('inf')
    for i in xrange(len(S)-10):
        good = (S[i]!='g')+(S[i+1]!='o')+(S[i+2]!='o')+(S[i+3]!='d')
        for j in xrange(i+4, len(S)-6):
            problem = (S[j] != 'p') + (S[j+1] != 'r') + (S[j+2] != 'o') + (S[j+3] != 'b') +\
                      (S[j+4] != 'l') + (S[j+5] != 'e') + (S[j+6] != 'm')
            ans = min(ans, good+problem)
    print ans
    
for _ in xrange(input()):
    solve()
0