結果

問題 No.113 宝探し
ユーザー soi09476291soi09476291
提出日時 2019-11-23 12:02:48
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,034 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 103,424 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2024-04-19 14:31:55
合計ジャッジ時間 2,128 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 23 ms
18,176 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 24 ms
18,304 KB
testcase_06 AC 23 ms
18,176 KB
testcase_07 AC 23 ms
18,048 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 23 ms
18,304 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 22 ms
18,304 KB
testcase_18 AC 23 ms
18,304 KB
testcase_19 AC 22 ms
18,176 KB
testcase_20 AC 24 ms
18,304 KB
testcase_21 AC 24 ms
18,432 KB
testcase_22 AC 23 ms
18,304 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text;
using System.Linq;

namespace ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();

            double countN = 0;
            double countE = 0;
            double countW = 0;
            double countS = 0;
            double sum = 0;

            for(int i = 0; i < S.Length; i++)
            {
                if(S[i] == 'N')
                {
                    countN++;
                }
                else if(S[i] == 'E')
                {
                    countE++;
                }
                else if(S[i] == 'W')
                {
                    countW++;
                }
                else if(S[i] == 'S')
                {
                    countS++;
                }
            }

            sum = (countN * countN) + (countE * countE) + (countW * countW) + (countS * countS);

            double root = Math.Sqrt(sum);

            Console.WriteLine(root);
        }        
    }
}
0