結果

問題 No.225 文字列変更(medium)
ユーザー TawaraTawara
提出日時 2015-08-04 20:07:16
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 344 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 33,796 KB
最終ジャッジ日時 2023-09-25 01:08:54
合計ジャッジ時間 9,781 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 505 ms
24,616 KB
testcase_02 AC 11 ms
5,896 KB
testcase_03 AC 11 ms
6,036 KB
testcase_04 AC 11 ms
5,844 KB
testcase_05 AC 11 ms
6,040 KB
testcase_06 AC 10 ms
6,080 KB
testcase_07 WA -
testcase_08 AC 11 ms
6,084 KB
testcase_09 AC 11 ms
5,884 KB
testcase_10 AC 11 ms
5,836 KB
testcase_11 AC 11 ms
5,940 KB
testcase_12 AC 706 ms
30,604 KB
testcase_13 AC 772 ms
33,796 KB
testcase_14 AC 746 ms
32,752 KB
testcase_15 AC 708 ms
25,784 KB
testcase_16 AC 721 ms
31,776 KB
testcase_17 AC 713 ms
26,224 KB
testcase_18 AC 694 ms
28,660 KB
testcase_19 AC 714 ms
31,972 KB
testcase_20 AC 674 ms
29,132 KB
testcase_21 AC 710 ms
31,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int,raw_input().split(" "))
S = list(raw_input())
T = list(raw_input())
dp = [[1000 for i in range(n+1)] for j in range(m+1)]
for i in range(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