結果
| 問題 |
No.225 文字列変更(medium)
|
| コンテスト | |
| ユーザー |
atsudr_2
|
| 提出日時 | 2017-12-20 10:41:51 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 946 bytes |
| コンパイル時間 | 1,116 ms |
| コンパイル使用メモリ | 103,552 KB |
| 実行使用メモリ | 20,736 KB |
| 最終ジャッジ日時 | 2024-12-16 06:49:04 |
| 合計ジャッジ時間 | 2,940 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
class MainClass
{
public static void Main(string[] args)
{
string[] s1 = Console.ReadLine().Split(' ');
int n = int.Parse(s1[0]);
int m = int.Parse(s1[1]);
string S = Console.ReadLine();
string T = Console.ReadLine();
int[,] dp = new int[n + 1, m + 1];
for (int i = 0; i < n;i++)
{
for (int j = 0; j < m;j++)
{
if(S[i]==T[j])
{
dp[i + 1, j + 1] = Math.Min(dp[i, j], dp[i + 1, j] + 1);
dp[i + 1, j + 1] = Math.Min(dp[i + 1, j + 1], dp[i, j + 1] + 1);
}
else
{
dp[i + 1, j + 1] = Math.Min(dp[i, j] + 1, dp[i + 1, j] + 1);
dp[i + 1, j + 1] = Math.Min(dp[i + 1, j + 1], dp[i, j + 1] + 1);
}
}
}
Console.WriteLine(dp[n,m]);
}
}
atsudr_2