結果

問題 No.113 宝探し
ユーザー kano_townkano_town
提出日時 2014-12-31 23:50:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 2,880 ms
コンパイル使用メモリ 75,328 KB
実行使用メモリ 54,168 KB
最終ジャッジ日時 2024-04-28 07:13:53
合計ジャッジ時間 6,952 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
54,020 KB
testcase_01 AC 109 ms
54,016 KB
testcase_02 AC 104 ms
52,932 KB
testcase_03 AC 106 ms
53,928 KB
testcase_04 AC 118 ms
54,032 KB
testcase_05 AC 111 ms
54,128 KB
testcase_06 AC 111 ms
54,136 KB
testcase_07 AC 102 ms
52,620 KB
testcase_08 AC 115 ms
53,976 KB
testcase_09 AC 114 ms
54,168 KB
testcase_10 AC 99 ms
52,532 KB
testcase_11 AC 110 ms
54,012 KB
testcase_12 AC 113 ms
54,104 KB
testcase_13 AC 110 ms
53,992 KB
testcase_14 AC 110 ms
53,884 KB
testcase_15 AC 107 ms
53,840 KB
testcase_16 AC 108 ms
54,084 KB
testcase_17 AC 100 ms
52,996 KB
testcase_18 AC 106 ms
53,476 KB
testcase_19 AC 110 ms
54,120 KB
testcase_20 AC 105 ms
53,960 KB
testcase_21 AC 110 ms
52,888 KB
testcase_22 AC 110 ms
54,152 KB
testcase_23 AC 97 ms
53,036 KB
testcase_24 AC 102 ms
53,072 KB
testcase_25 AC 112 ms
53,980 KB
testcase_26 AC 114 ms
53,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Yukicoder113 {
	public static void main(String[] args) {
		String s = new Scanner(System.in).next();
		double ew = 0, ns = 0;
		for (int i = 0; i < s.length(); i++) {
			switch(s.charAt(i)) {
				case 'N':
					ns++;
					break;
				case 'E':
					ew++;
					break;
				case 'W':
					ew--;
					break;
				case 'S':
					ns--;
					break;
			}
		}
		System.out.println(Math.hypot(ns, ew));
	}
}
0