結果

問題 No.150 "良問"(良問とは言っていない
ユーザー mlihua09mlihua09
提出日時 2020-09-17 17:03:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 1,005 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 77,228 KB
最終ジャッジ日時 2023-09-04 07:22:26
合計ジャッジ時間 4,437 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
77,044 KB
testcase_01 AC 75 ms
71,148 KB
testcase_02 AC 79 ms
71,472 KB
testcase_03 AC 75 ms
71,424 KB
testcase_04 AC 76 ms
71,320 KB
testcase_05 AC 82 ms
76,448 KB
testcase_06 AC 148 ms
77,164 KB
testcase_07 AC 73 ms
71,148 KB
testcase_08 AC 84 ms
76,460 KB
testcase_09 AC 82 ms
76,452 KB
testcase_10 AC 105 ms
76,976 KB
testcase_11 AC 109 ms
76,996 KB
testcase_12 AC 103 ms
77,112 KB
testcase_13 AC 106 ms
76,708 KB
testcase_14 AC 108 ms
76,728 KB
testcase_15 AC 112 ms
76,792 KB
testcase_16 AC 86 ms
76,444 KB
testcase_17 AC 98 ms
76,912 KB
testcase_18 AC 105 ms
77,088 KB
testcase_19 AC 113 ms
77,004 KB
testcase_20 AC 111 ms
77,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

g = 'good'
p = 'problem'
for _ in range(int(input())):
    
    s = input()
    n = len(s)
    
    ans = n
    for i in range(n - 10):
        x = 0
        for j in range(4):
            if s[i + j] != g[j]:
                x += 1
                
        for j in range(i + 4, n - 6):
            
            y = x
            for k in range(7):
                if s[j + k] != p[k]:
                    y += 1
                    
            ans = min(ans, y)
            
    print(ans)
0