結果

問題 No.225 文字列変更(medium)
ユーザー moriiforfunmoriiforfun
提出日時 2018-06-13 00:18:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 911 ms / 5,000 ms
コード長 392 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 39,532 KB
最終ジャッジ日時 2023-09-13 03:44:10
合計ジャッジ時間 10,652 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 366 ms
19,424 KB
testcase_01 AC 613 ms
29,452 KB
testcase_02 AC 16 ms
7,868 KB
testcase_03 AC 16 ms
7,804 KB
testcase_04 AC 16 ms
7,848 KB
testcase_05 AC 16 ms
7,852 KB
testcase_06 AC 17 ms
7,796 KB
testcase_07 AC 16 ms
7,928 KB
testcase_08 AC 16 ms
7,720 KB
testcase_09 AC 16 ms
7,796 KB
testcase_10 AC 17 ms
7,720 KB
testcase_11 AC 16 ms
7,908 KB
testcase_12 AC 762 ms
33,204 KB
testcase_13 AC 911 ms
39,532 KB
testcase_14 AC 882 ms
38,040 KB
testcase_15 AC 654 ms
23,180 KB
testcase_16 AC 854 ms
37,388 KB
testcase_17 AC 647 ms
23,064 KB
testcase_18 AC 713 ms
28,212 KB
testcase_19 AC 860 ms
37,428 KB
testcase_20 AC 711 ms
30,348 KB
testcase_21 AC 836 ms
36,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

suteru=input()
S=input()
T=input()
ls = len(S)
lt = len(T)
dp = [[0]*(ls+1) for _ in range(lt+1)]
for i in range(lt+1):
    dp[i][0] = i
for j in range(ls+1):
    dp[0][j] = j

for i in range(1,lt+1):
    for j in range(1,ls+1):
        if S[j-1] == T[i-1]:
            dp[i][j] = dp[i-1][j-1]
        else:
            dp[i][j] = min(dp[i-1][j],dp[i][j-1],dp[i-1][j-1]) + 1
print(dp[lt][ls])
0