結果

問題 No.113 宝探し
ユーザー CroweaCrowea
提出日時 2019-01-29 23:30:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 35 ms / 5,000 ms
コード長 820 bytes
コンパイル時間 1,251 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 28,224 KB
最終ジャッジ日時 2024-04-28 08:18:47
合計ジャッジ時間 2,672 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
28,020 KB
testcase_01 AC 35 ms
26,176 KB
testcase_02 AC 34 ms
25,980 KB
testcase_03 AC 34 ms
28,224 KB
testcase_04 AC 34 ms
28,148 KB
testcase_05 AC 34 ms
24,112 KB
testcase_06 AC 34 ms
25,976 KB
testcase_07 AC 35 ms
28,096 KB
testcase_08 AC 35 ms
28,144 KB
testcase_09 AC 34 ms
26,032 KB
testcase_10 AC 34 ms
26,172 KB
testcase_11 AC 34 ms
26,232 KB
testcase_12 AC 33 ms
26,104 KB
testcase_13 AC 33 ms
28,144 KB
testcase_14 AC 32 ms
26,172 KB
testcase_15 AC 35 ms
26,364 KB
testcase_16 AC 34 ms
25,976 KB
testcase_17 AC 32 ms
28,152 KB
testcase_18 AC 32 ms
26,108 KB
testcase_19 AC 34 ms
26,176 KB
testcase_20 AC 33 ms
26,232 KB
testcase_21 AC 33 ms
26,032 KB
testcase_22 AC 35 ms
26,428 KB
testcase_23 AC 33 ms
27,432 KB
testcase_24 AC 34 ms
26,172 KB
testcase_25 AC 34 ms
28,148 KB
testcase_26 AC 34 ms
26,284 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

class Program
{
    const char North = 'N';
    const char East = 'E';
    const char West = 'W';
    const char South = 'S';
    static void Main(string[] args)
    {
        var line = Console.ReadLine().ToCharArray().OrderBy(x => x).ToList();
        int nCnt = line.Count(x => x == North);
        int eCnt = line.Count(x => x == East);
        int wCnt = line.Count(x => x == West);
        int sCnt = line.Count(x => x == South);

        int horizontal = Math.Abs(nCnt - sCnt);
        int vartical = Math.Abs(eCnt - wCnt);

        var dist = Math.Sqrt(
                        Math.Pow(horizontal, 2) +
                        Math.Pow(vartical, 2) 
                   );
        Console.WriteLine(Math.Round(dist,5, MidpointRounding.AwayFromZero));
        return;
    }
}



0