結果

問題 No.113 宝探し
ユーザー mrc1031mrc1031
提出日時 2016-10-12 10:52:08
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 1,942 ms
コンパイル使用メモリ 104,228 KB
実行使用メモリ 24,544 KB
最終ジャッジ日時 2023-08-10 14:49:06
合計ジャッジ時間 4,662 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
22,392 KB
testcase_01 AC 56 ms
20,388 KB
testcase_02 AC 57 ms
22,344 KB
testcase_03 AC 57 ms
22,440 KB
testcase_04 AC 56 ms
22,328 KB
testcase_05 AC 57 ms
22,368 KB
testcase_06 AC 58 ms
22,336 KB
testcase_07 AC 58 ms
24,424 KB
testcase_08 AC 57 ms
22,504 KB
testcase_09 AC 58 ms
24,436 KB
testcase_10 AC 58 ms
24,392 KB
testcase_11 AC 57 ms
20,292 KB
testcase_12 AC 58 ms
20,372 KB
testcase_13 AC 57 ms
22,400 KB
testcase_14 AC 56 ms
24,344 KB
testcase_15 AC 58 ms
22,404 KB
testcase_16 AC 57 ms
24,544 KB
testcase_17 AC 58 ms
20,368 KB
testcase_18 AC 58 ms
22,340 KB
testcase_19 AC 58 ms
22,516 KB
testcase_20 AC 58 ms
24,440 KB
testcase_21 AC 58 ms
24,404 KB
testcase_22 AC 58 ms
22,508 KB
testcase_23 AC 55 ms
20,596 KB
testcase_24 AC 58 ms
22,372 KB
testcase_25 AC 55 ms
20,484 KB
testcase_26 AC 57 ms
22,336 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