結果

問題 No.113 宝探し
ユーザー mrc1031mrc1031
提出日時 2016-10-12 10:52:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 2,573 ms
コンパイル使用メモリ 108,972 KB
実行使用メモリ 28,824 KB
最終ジャッジ日時 2024-04-28 07:51:22
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,796 KB
testcase_01 AC 26 ms
26,656 KB
testcase_02 AC 26 ms
24,668 KB
testcase_03 AC 26 ms
24,752 KB
testcase_04 AC 26 ms
26,784 KB
testcase_05 AC 27 ms
26,780 KB
testcase_06 AC 26 ms
24,668 KB
testcase_07 AC 25 ms
24,756 KB
testcase_08 AC 26 ms
24,860 KB
testcase_09 AC 26 ms
26,584 KB
testcase_10 AC 27 ms
24,928 KB
testcase_11 AC 26 ms
24,876 KB
testcase_12 AC 26 ms
24,412 KB
testcase_13 AC 26 ms
24,496 KB
testcase_14 AC 26 ms
26,400 KB
testcase_15 AC 27 ms
26,772 KB
testcase_16 AC 27 ms
28,824 KB
testcase_17 AC 27 ms
24,880 KB
testcase_18 AC 26 ms
26,784 KB
testcase_19 AC 26 ms
24,620 KB
testcase_20 AC 26 ms
26,712 KB
testcase_21 AC 26 ms
26,584 KB
testcase_22 AC 25 ms
24,672 KB
testcase_23 AC 25 ms
23,908 KB
testcase_24 AC 27 ms
24,804 KB
testcase_25 AC 27 ms
24,864 KB
testcase_26 AC 26 ms
24,668 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
{
    static void Main(string[] args)
    {
        // No.113 宝探し

        char[] S = Console.ReadLine().ToCharArray();

        int N = 0, E = 0;

        for (int i = 0; i < S.Length; i++)
        {
            if ('N'.Equals(S[i])) N++;
            if ('E'.Equals(S[i])) E++;
            if ('W'.Equals(S[i])) E--;
            if ('S'.Equals(S[i])) N--;
        }

        Console.WriteLine(Math.Round(Math.Sqrt(N * N + E * E),5));
    }
}
0