結果

問題 No.150 "良問"(良問とは言っていない
ユーザー kbyskbys
提出日時 2020-07-18 07:18:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 76,520 KB
最終ジャッジ日時 2023-08-20 16:54:40
合計ジャッジ時間 3,290 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 74 ms
71,260 KB
testcase_02 AC 74 ms
71,264 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 75 ms
71,404 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

good = "good"
prob = "problem"
def func(moji):
    good_index = 0
    good_c = 4
    for i in range(len(moji)-7):
        tmp = 4
        for k in range(4):
            if moji[i+k] == good[k]:
                tmp -= 1
        if tmp < good_c:
            good_index = i
            good_c = tmp
    prob_index = good_index+4
    prob_c = 7
    for j in range(len(moji)-prob_index-7+1):
        tmp = 7
        for k in range(7):
            if moji[prob_index+j+k] == prob[k]:
                tmp -= 1
        prob_c = min(prob_c, tmp)
    print(good_c+prob_c)

for i in range(n):
    func(input())
0