結果
| 問題 |
No.208 王将
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-17 20:22:33 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,147 bytes |
| コンパイル時間 | 1,043 ms |
| コンパイル使用メモリ | 112,908 KB |
| 実行使用メモリ | 29,432 KB |
| 最終ジャッジ日時 | 2024-10-09 16:56:41 |
| 合計ジャッジ時間 | 2,472 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 13 RE * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4 {
class Program {
static void Main() {
int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
int[] b = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
int x = a[0];
int y = a[1];
int x1 = b[0];
int y1 = b[1];
long[,] f = new long[y, x];
for(int i = 0; i < y; i++) {
for(int j = 0; j < x; j++) {
if (i == 0) {
f[i, j] = j+1;
}
else if (j == 0) {
f[i, j] = i+1;
}
else if (i == y1 && j == x1) {
f[i, j] = long.MaxValue;
}
else {
f[i, j] = Math.Min(f[i - 1, j], f[i, j - 1]) + 1;
}
}
}
Console.WriteLine(f[y - 1, x - 1]);
}
}
}