結果

問題 No.150 "良問"(良問とは言っていない
ユーザー fmhrfmhr
提出日時 2015-02-13 00:38:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 5,000 ms
コード長 417 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,596 KB
最終ジャッジ日時 2024-04-19 09:17:53
合計ジャッジ時間 3,275 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
76,032 KB
testcase_01 AC 39 ms
51,712 KB
testcase_02 AC 37 ms
51,968 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 36 ms
52,352 KB
testcase_05 AC 55 ms
70,656 KB
testcase_06 AC 205 ms
76,288 KB
testcase_07 AC 37 ms
52,480 KB
testcase_08 AC 52 ms
66,304 KB
testcase_09 AC 44 ms
60,032 KB
testcase_10 AC 100 ms
76,160 KB
testcase_11 AC 115 ms
76,416 KB
testcase_12 AC 93 ms
76,032 KB
testcase_13 AC 112 ms
76,416 KB
testcase_14 AC 123 ms
76,596 KB
testcase_15 AC 110 ms
76,160 KB
testcase_16 AC 67 ms
76,032 KB
testcase_17 AC 88 ms
76,032 KB
testcase_18 AC 110 ms
76,020 KB
testcase_19 AC 134 ms
75,904 KB
testcase_20 AC 129 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


t = int(input())
ans = []
for i in range(t):
    s = input()
    cost = 100
    for j in range(len(s)):
        for k in range(j+4,len(s)-6,1):
            cost = min(cost, check(s[j:j+4], 'good') + check(s[k:k+7], 'problem'))

    ans.append(cost)

for p in range(t):
    print(ans[p])
0