結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-11 09:51:11 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 79 ms / 5,000 ms |
| コード長 | 813 bytes |
| コンパイル時間 | 8,258 ms |
| コンパイル使用メモリ | 171,068 KB |
| 実行使用メモリ | 186,632 KB |
| 最終ジャッジ日時 | 2025-11-11 09:51:23 |
| 合計ジャッジ時間 | 11,614 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (147 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
class Program
{
static void Main(string[] args)
{
string direction = Console.ReadLine()!;
double xCount = 0;
double yCount = 0;
foreach (char c in direction)
{
if (c == 'N')
{
yCount++;
}
else if (c == 'E')
{
xCount++;
}
else if (c == 'W')
{
xCount--;
}
else
{
yCount--;
}
}
if (xCount < 0)
{
xCount *= -1;
}
else if (yCount < 0)
{
yCount *= -1;
}
double ans = xCount * xCount + yCount * yCount;
ans = Math.Sqrt(ans);
Console.WriteLine(ans);
}
}