結果

問題 No.150 "良問"(良問とは言っていない
ユーザー Konton7Konton7
提出日時 2019-05-19 21:22:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 652 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,800 KB
実行使用メモリ 10,104 KB
最終ジャッジ日時 2023-10-17 07:59:35
合計ジャッジ時間 2,529 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
10,096 KB
testcase_01 AC 32 ms
10,096 KB
testcase_02 AC 30 ms
10,096 KB
testcase_03 AC 29 ms
10,096 KB
testcase_04 AC 29 ms
10,096 KB
testcase_05 AC 30 ms
10,096 KB
testcase_06 AC 63 ms
10,104 KB
testcase_07 AC 29 ms
10,096 KB
testcase_08 AC 29 ms
10,096 KB
testcase_09 AC 29 ms
10,096 KB
testcase_10 AC 40 ms
10,096 KB
testcase_11 AC 40 ms
10,096 KB
testcase_12 AC 37 ms
10,096 KB
testcase_13 AC 41 ms
10,096 KB
testcase_14 AC 44 ms
10,096 KB
testcase_15 AC 42 ms
10,096 KB
testcase_16 AC 30 ms
10,096 KB
testcase_17 AC 34 ms
10,096 KB
testcase_18 AC 43 ms
10,100 KB
testcase_19 AC 46 ms
10,100 KB
testcase_20 AC 45 ms
10,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def goodploblem(string):
    len_s = len(string)
    good = [ 0 for i in range(len_s) ]
    plobrem = [ 0 for i in range(len_s) ]
    
    for i in range(len_s-10):
        
        good[i] =  judge(string[i:i+4],"good")
    for i in range(4,len_s-6):
        
        plobrem[i] =  judge(string[i:i+7],"problem")

    ans = 11
    for i in range(len_s-10):

        ans =  min(ans,(good[i]+min(plobrem[i+4:len_s-6])))

    return ans

def judge(instr,target):
    s = 0
    t = len(target)
    for i in range(t):
        if target[i] == instr[i]:
            s += 1
    return t-s

n = int(input())

for i in range(n):
    print(goodploblem(input()))
0