結果

問題 No.252 "良問"(良問とは言っていない (2)
ユーザー fmhrfmhr
提出日時 2015-07-25 15:49:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 644 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 88,732 KB
最終ジャッジ日時 2023-09-24 12:12:59
合計ジャッジ時間 7,196 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

def check(s1, s2):
    c = 0
    for i in range(len(s1)):
        if s1[i]!=s2[i]:
            c += 1
    return c


t = int(input())

for i in range(t):
    s = input()
    cost = 100
    p_cost = 0
    for j in range(len(s)):
        if j>=7:
            if s[j-7:j]=='problem':
                p_cost += 1
        for k in range(j+4, len(s)-6, 1):
            # if cost>check(s[j:j+4], 'good')+check(s[k:k+7], 'problem')+p_cost:
            #     cost = check(s[j:j+4], 'good')+check(s[k:k+7], 'problem')+p_cost
            cost = min(cost, check(s[j:j+4], 'good')+check(s[k:k+7], 'problem')+p_cost)
    print(cost)
0