結果

問題 No.113 宝探し
ユーザー abL8ZLsTbF
提出日時 2016-05-27 11:05:11
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 22 ms / 5,000 ms
コード長 426 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 101,888 KB
実行使用メモリ 18,688 KB
最終ジャッジ日時 2024-11-16 21:14:27
合計ジャッジ時間 2,049 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
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