結果
| 問題 | No.225 文字列変更(medium) |
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-06-13 20:45:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 481 bytes |
| 記録 | |
| コンパイル時間 | 480 ms |
| コンパイル使用メモリ | 57,948 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2024-07-06 19:52:22 |
| 合計ジャッジ時間 | 1,098 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 7 |
ソースコード
#include <iostream>
#include <algorithm>
int N, M;
std::string S, T;
int dp[1001][1001];
int main(){
std::cin >> N >> M;
std::cin >> S >> T;
for(int i=1;i<N;i++){
dp[i][0] = i;
}
for(int i=1;i<M;i++){
dp[0][i] = i;
}
for(int i=1;i<=N;i++){
for(int j=1;j<=M;j++){
dp[i][j] = std::min({dp[i-1][j] + 1, dp[i][j-1] + 1, dp[i-1][j-1] + (S[i-1] != T[j-1])});
}
}
std::cout << dp[N][M] << std::endl;
}
tottoripaper