結果
| 問題 | No.225 文字列変更(medium) |
| コンテスト | |
| ユーザー |
atsudr_2
|
| 提出日時 | 2017-12-20 10:51:10 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,065 bytes |
| 記録 | |
| コンパイル時間 | 495 ms |
| コンパイル使用メモリ | 113,196 KB |
| 実行使用メモリ | 29,196 KB |
| 最終ジャッジ日時 | 2026-05-26 11:33:55 |
| 合計ジャッジ時間 | 1,859 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 5 |
コンパイルメッセージ
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++) dp[i, j] = 1000;
dp[0, 0] = 0;
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