結果

問題 No.113 宝探し
ユーザー abL8ZLsTbFabL8ZLsTbF
提出日時 2016-05-27 11:05:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 426 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 98,656 KB
実行使用メモリ 24,580 KB
最終ジャッジ日時 2023-08-10 14:37:51
合計ジャッジ時間 4,749 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
24,568 KB
testcase_01 AC 60 ms
22,492 KB
testcase_02 AC 59 ms
22,576 KB
testcase_03 AC 59 ms
20,452 KB
testcase_04 AC 61 ms
24,544 KB
testcase_05 AC 60 ms
22,508 KB
testcase_06 AC 60 ms
22,424 KB
testcase_07 AC 60 ms
22,432 KB
testcase_08 AC 61 ms
22,428 KB
testcase_09 AC 59 ms
24,492 KB
testcase_10 AC 60 ms
22,484 KB
testcase_11 AC 60 ms
24,484 KB
testcase_12 AC 59 ms
22,564 KB
testcase_13 AC 60 ms
22,492 KB
testcase_14 AC 60 ms
22,436 KB
testcase_15 AC 59 ms
22,516 KB
testcase_16 AC 59 ms
24,580 KB
testcase_17 AC 59 ms
22,432 KB
testcase_18 AC 58 ms
22,440 KB
testcase_19 AC 59 ms
24,424 KB
testcase_20 AC 60 ms
22,556 KB
testcase_21 AC 61 ms
22,548 KB
testcase_22 AC 60 ms
22,520 KB
testcase_23 AC 56 ms
22,496 KB
testcase_24 AC 60 ms
22,480 KB
testcase_25 AC 60 ms
22,548 KB
testcase_26 AC 61 ms
22,628 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program
{
	public static int CountChar(string str, char ch)
	{
		return str.Length - str.Replace(ch.ToString(), "").Length;
	}
	
	public static void Main()
	{
		string move = Console.ReadLine();
		int n = CountChar(move, 'N');
		int s = CountChar(move, 'S');
		int e = CountChar(move, 'E');
		int w = CountChar(move, 'W');
		Console.WriteLine(Math.Sqrt((n - s) * (n - s) + (e - w) * (e - w)));
	}
}
0