結果
| 問題 | No.113 宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-01 14:34:56 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 5,000 ms |
| コード長 | 899 bytes |
| コンパイル時間 | 8,265 ms |
| コンパイル使用メモリ | 170,976 KB |
| 実行使用メモリ | 186,644 KB |
| 最終ジャッジ日時 | 2025-12-01 14:35:14 |
| 合計ジャッジ時間 | 11,312 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (105 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
public class Program
{
public static void Main()
{
//int num = int.Parse(Console.ReadLine() ?? string.Empty);
//string[] str = (Console.ReadLine() ?? string.Empty).Trim().Split(' ');
string str = Console.ReadLine() ?? string.Empty;
//E6 S7 W4 N3 = s4 e2
int e = 0;
int s = 0;
int w = 0;
int n = 0;
for (int i = 0; i < str.Length; i++)
{
if (str[i] == 'E')
{
e++;
}
else if (str[i] == 'S')
{
s++;
}
else if (str[i] == 'W')
{
w++;
}
else
{
n++;
}
}
int a = ((n - s) * (n - s)) + ((e - w) * (e - w));
double d = Math.Sqrt(a);
Console.WriteLine(d);
}
}