結果

問題 No.113 宝探し
ユーザー r.suzukir.suzuki
提出日時 2016-01-06 23:35:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 504 bytes
コンパイル時間 2,878 ms
コンパイル使用メモリ 75,060 KB
実行使用メモリ 41,624 KB
最終ジャッジ日時 2024-04-28 07:33:50
合計ジャッジ時間 6,768 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
41,432 KB
testcase_01 AC 113 ms
41,180 KB
testcase_02 AC 114 ms
41,560 KB
testcase_03 AC 105 ms
41,328 KB
testcase_04 AC 102 ms
41,412 KB
testcase_05 AC 108 ms
40,124 KB
testcase_06 AC 100 ms
41,056 KB
testcase_07 AC 99 ms
39,916 KB
testcase_08 AC 104 ms
41,060 KB
testcase_09 AC 99 ms
41,404 KB
testcase_10 AC 100 ms
41,316 KB
testcase_11 AC 105 ms
39,916 KB
testcase_12 AC 109 ms
41,316 KB
testcase_13 AC 108 ms
41,364 KB
testcase_14 AC 98 ms
41,624 KB
testcase_15 AC 112 ms
41,300 KB
testcase_16 AC 103 ms
41,084 KB
testcase_17 AC 96 ms
41,144 KB
testcase_18 AC 106 ms
41,360 KB
testcase_19 AC 107 ms
41,444 KB
testcase_20 AC 112 ms
40,988 KB
testcase_21 AC 99 ms
39,956 KB
testcase_22 AC 105 ms
41,360 KB
testcase_23 AC 103 ms
40,040 KB
testcase_24 AC 102 ms
41,228 KB
testcase_25 AC 120 ms
41,048 KB
testcase_26 AC 115 ms
41,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

public class No_113 {
	static int X;
	static int Y;

	static void move(char c) {
		switch (c) {
		case 'N':
			Y++;
			break;
		case 'E':
			X++;
			break;
		case 'S':
			Y--;
			break;
		case 'W':
			X--;
			break;

		}
	}

	public static void main(String[] args) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		String s = sc.next();
		char[] direction = s.toCharArray();

		for (char c : direction) {
			move(c);
		}

		System.out.println(Math.sqrt(X * X + Y * Y));
		sc.close();

	}

}
0