結果

問題 No.113 宝探し
ユーザー spaciaspacia
提出日時 2016-01-02 08:48:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 2,271 ms
コンパイル使用メモリ 73,480 KB
実行使用メモリ 50,428 KB
最終ジャッジ日時 2024-04-28 07:33:20
合計ジャッジ時間 3,955 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
50,244 KB
testcase_01 AC 48 ms
50,004 KB
testcase_02 AC 49 ms
50,012 KB
testcase_03 AC 48 ms
50,048 KB
testcase_04 AC 50 ms
49,912 KB
testcase_05 AC 48 ms
50,428 KB
testcase_06 AC 47 ms
50,148 KB
testcase_07 AC 49 ms
49,680 KB
testcase_08 AC 50 ms
50,064 KB
testcase_09 AC 50 ms
50,028 KB
testcase_10 AC 48 ms
50,392 KB
testcase_11 AC 48 ms
49,876 KB
testcase_12 AC 48 ms
49,624 KB
testcase_13 AC 48 ms
50,228 KB
testcase_14 AC 46 ms
50,056 KB
testcase_15 AC 49 ms
50,024 KB
testcase_16 AC 48 ms
49,968 KB
testcase_17 AC 50 ms
49,612 KB
testcase_18 AC 50 ms
50,008 KB
testcase_19 AC 52 ms
49,876 KB
testcase_20 AC 51 ms
50,096 KB
testcase_21 AC 48 ms
49,900 KB
testcase_22 AC 47 ms
49,996 KB
testcase_23 AC 49 ms
49,996 KB
testcase_24 AC 48 ms
49,908 KB
testcase_25 AC 50 ms
49,780 KB
testcase_26 AC 48 ms
49,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main113 {
	
	public static void out (Object o) {
		System.out.println(o);
	}
		
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String s = br.readLine();
		int x = 0 , y = 0;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c == 'N')
				y--;
			else if (c == 'E')
				x++;
			else if (c == 'W')
				x--;
			else
				y++;
		}
		
		x = Math.abs(x);
		y = Math.abs(y);
		
		out(Math.sqrt(x * x + y * y));
	}
}
0