結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2015-06-08 15:11:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 21 ms / 5,000 ms |
コード長 | 1,409 bytes |
コンパイル時間 | 1,967 ms |
コンパイル使用メモリ | 106,880 KB |
実行使用メモリ | 18,944 KB |
最終ジャッジ日時 | 2024-11-16 20:57:31 |
合計ジャッジ時間 | 2,214 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.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { char[] S = Console.ReadLine().ToCharArray(); int x = 0; int y = 0; foreach (var c in S) { switch (c) { case 'E': x += 1; break; case 'S': y -= 1; break; case 'W': x -= 1; break; case 'N': y += 1; break; } } double ans = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2)); Console.WriteLine(ans); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] str, int defaultValue) { int[] b = Array.ConvertAll<string, int>(str, delegate(string value) { return int.Parse(value); }); for (int i = 0; i < b.Length; i++) { b[i] = defaultValue; } return b; } } }