結果

問題 No.150 "良問"(良問とは言っていない
ユーザー Konton7Konton7
提出日時 2019-05-19 21:22:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 652 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-17 06:32:54
合計ジャッジ時間 1,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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