結果

問題 No.150 "良問"(良問とは言っていない
ユーザー tookunn_1213tookunn_1213
提出日時 2017-06-17 11:06:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,080 ms / 5,000 ms
コード長 544 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-19 09:45:03
合計ジャッジ時間 5,695 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 242 ms
10,880 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 29 ms
10,880 KB
testcase_05 AC 41 ms
10,752 KB
testcase_06 AC 1,080 ms
10,752 KB
testcase_07 AC 28 ms
10,752 KB
testcase_08 AC 33 ms
10,880 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 268 ms
10,880 KB
testcase_11 AC 296 ms
10,752 KB
testcase_12 AC 204 ms
10,752 KB
testcase_13 AC 278 ms
10,752 KB
testcase_14 AC 364 ms
10,880 KB
testcase_15 AC 343 ms
10,752 KB
testcase_16 AC 53 ms
10,752 KB
testcase_17 AC 120 ms
10,752 KB
testcase_18 AC 327 ms
10,880 KB
testcase_19 AC 393 ms
10,752 KB
testcase_20 AC 414 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
S = [input() for i in range(T)]
good = 'good'
good_len = len(good)
problem = 'problem'
problem_len = len(problem)
for t in range(T):
	N = len(S[t])
	ans = 10**9+7

	for i in range(0,N-good_len-problem_len+1):
		good_cnt = 0
		for j in range(good_len):
			if S[t][i+j] != good[j]: 
				good_cnt+=1
		for j in range(i+good_len,N-problem_len+1):
			cnt = 0
			#print(S[t][i:i+good_len],S[t][j:j+problem_len])
			for k in range(problem_len):
				if S[t][j+k] != problem[k]:
					cnt+=1
			ans = min(ans,good_cnt + cnt)
	print(ans)
0