結果

問題 No.150 "良問"(良問とは言っていない
ユーザー 👑 rin204rin204
提出日時 2022-01-20 09:29:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 86,560 KB
実行使用メモリ 76,780 KB
最終ジャッジ日時 2023-08-15 08:33:16
合計ジャッジ時間 3,673 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
76,596 KB
testcase_01 AC 73 ms
71,052 KB
testcase_02 AC 73 ms
71,280 KB
testcase_03 AC 77 ms
71,020 KB
testcase_04 AC 73 ms
71,152 KB
testcase_05 AC 79 ms
76,020 KB
testcase_06 AC 135 ms
76,456 KB
testcase_07 AC 72 ms
71,216 KB
testcase_08 AC 79 ms
76,128 KB
testcase_09 AC 79 ms
75,956 KB
testcase_10 AC 101 ms
76,232 KB
testcase_11 AC 104 ms
76,520 KB
testcase_12 AC 99 ms
76,552 KB
testcase_13 AC 101 ms
76,520 KB
testcase_14 AC 107 ms
76,580 KB
testcase_15 AC 111 ms
76,780 KB
testcase_16 AC 84 ms
76,268 KB
testcase_17 AC 93 ms
76,516 KB
testcase_18 AC 102 ms
76,436 KB
testcase_19 AC 111 ms
76,632 KB
testcase_20 AC 107 ms
76,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    S = input()
    l = len(S)
    ans = 11
    for i in range(l - 3):
        cnt = 0
        for j in range(4):
            if S[i + j] != "good"[j]:
                cnt += 1
        for j in range(i + 4, l - 6):
            cnt2 = 0
            for k in range(7):
                if S[j + k] != "problem"[k]:
                    cnt2 += 1
            ans = min(ans, cnt + cnt2)
    print(ans)
        

for _ in range(int(input())):
    solve()
0