結果

問題 No.150 "良問"(良問とは言っていない
ユーザー zombietanzombietan
提出日時 2016-05-25 18:26:50
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 174 ms / 5,000 ms
コード長 624 bytes
コンパイル時間 73 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 7,996 KB
最終ジャッジ日時 2023-08-01 10:00:35
合計ジャッジ時間 2,007 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
7,772 KB
testcase_01 AC 16 ms
7,776 KB
testcase_02 AC 16 ms
7,916 KB
testcase_03 AC 16 ms
7,996 KB
testcase_04 AC 16 ms
7,860 KB
testcase_05 AC 17 ms
7,848 KB
testcase_06 AC 174 ms
7,868 KB
testcase_07 AC 15 ms
7,852 KB
testcase_08 AC 17 ms
7,912 KB
testcase_09 AC 16 ms
7,864 KB
testcase_10 AC 55 ms
7,896 KB
testcase_11 AC 61 ms
7,996 KB
testcase_12 AC 45 ms
7,952 KB
testcase_13 AC 59 ms
7,908 KB
testcase_14 AC 71 ms
7,784 KB
testcase_15 AC 66 ms
7,948 KB
testcase_16 AC 19 ms
7,860 KB
testcase_17 AC 31 ms
7,776 KB
testcase_18 AC 67 ms
7,956 KB
testcase_19 AC 75 ms
7,856 KB
testcase_20 AC 80 ms
7,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
S = [input() for _ in range(T)]
        
for s in S:
    cc = len(s)
    g = []
    p = []
    for gi in range(0, cc-3):
        gcount = 0
        for j, k in zip(s[gi:gi+4], 'good'):
            if j != k:
                gcount += 1
        g.append([gcount, gi+3])
    for pi in range(0, cc-6):
        pcount = 0
        for n, m in zip(s[pi:pi+7], 'problem'):
            if n != m:
                pcount += 1
        p.append([pcount, pi])
    ans = set()
    for cg in g:
        for cp in p:
            if cg[1] < cp[1]:
                ans.add(cg[0] + cp[0])
    print(min(ans))
                
0