結果

問題 No.150 "良問"(良問とは言っていない
ユーザー tikitaka1201tikitaka1201
提出日時 2020-06-30 20:42:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 340 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 78,960 KB
最終ジャッジ日時 2023-10-11 09:53:58
合計ジャッジ時間 4,819 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
78,320 KB
testcase_01 AC 76 ms
71,524 KB
testcase_02 AC 75 ms
71,640 KB
testcase_03 AC 75 ms
71,292 KB
testcase_04 AC 76 ms
71,140 KB
testcase_05 AC 108 ms
77,916 KB
testcase_06 AC 340 ms
78,960 KB
testcase_07 AC 74 ms
71,144 KB
testcase_08 AC 95 ms
76,740 KB
testcase_09 AC 88 ms
75,768 KB
testcase_10 AC 167 ms
78,052 KB
testcase_11 AC 169 ms
77,968 KB
testcase_12 AC 148 ms
78,124 KB
testcase_13 AC 172 ms
77,960 KB
testcase_14 AC 187 ms
78,348 KB
testcase_15 AC 175 ms
77,628 KB
testcase_16 AC 110 ms
77,580 KB
testcase_17 AC 139 ms
78,396 KB
testcase_18 AC 172 ms
78,016 KB
testcase_19 AC 196 ms
78,636 KB
testcase_20 AC 190 ms
78,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
a=list('good')
b=list('problem')

for _ in range(t):
    s=list(input())
    n=len(s)
    ans=11
    for i in range(n-10):
        a0=s[i:i+4]
        tmpa=sum([0 if a[l]==a0[l] else 1 for l in range(4)])
        for j in range(i+4, n-6):
            b0=s[j:j+7]
            tmpb=sum([0 if b[l]==b0[l] else 1 for l in range(7)])
            ans=min(ans, tmpa+tmpb)
    print(ans)
0