結果

問題 No.225 文字列変更(medium)
ユーザー TawaraTawara
提出日時 2015-08-04 19:41:21
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 6,508 KB
実行使用メモリ 28,360 KB
最終ジャッジ日時 2023-09-25 01:07:51
合計ジャッジ時間 10,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 11 ms
5,976 KB
testcase_03 AC 11 ms
5,968 KB
testcase_04 WA -
testcase_05 AC 11 ms
6,140 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 11 ms
5,940 KB
testcase_09 AC 12 ms
5,860 KB
testcase_10 WA -
testcase_11 AC 11 ms
5,956 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int,raw_input().split(" "))
S = list(raw_input())
T = list(raw_input())
dp = [[0 for i in range(n+1)] for j in range(m+1)]
for i in range(1,n+1):
	dp[0][i] = i
for i in range(1,m+1):
	dp[i][0] = i
for i in range(1,m+1):
	for j in range(n+1):
		dp[i][j] = min(dp[i][j-1]+1, dp[i-1][j]+1, dp[i-1][j-1]+(T[i-1]!=S[j-1]))
print dp[m][n]
0