結果

問題 No.113 宝探し
ユーザー YOSHIYOSHI
提出日時 2021-02-28 00:11:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 592 bytes
コンパイル時間 3,219 ms
コンパイル使用メモリ 75,540 KB
実行使用メモリ 50,400 KB
最終ジャッジ日時 2024-04-10 15:52:13
合計ジャッジ時間 5,243 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
50,212 KB
testcase_01 AC 50 ms
50,248 KB
testcase_02 AC 49 ms
50,324 KB
testcase_03 AC 49 ms
50,164 KB
testcase_04 AC 50 ms
49,952 KB
testcase_05 AC 50 ms
50,392 KB
testcase_06 AC 49 ms
50,320 KB
testcase_07 AC 48 ms
50,228 KB
testcase_08 AC 48 ms
50,340 KB
testcase_09 AC 47 ms
50,276 KB
testcase_10 AC 49 ms
50,360 KB
testcase_11 AC 47 ms
50,280 KB
testcase_12 AC 47 ms
50,368 KB
testcase_13 AC 48 ms
50,376 KB
testcase_14 AC 50 ms
50,144 KB
testcase_15 AC 47 ms
49,848 KB
testcase_16 AC 47 ms
50,256 KB
testcase_17 AC 46 ms
50,300 KB
testcase_18 AC 46 ms
50,080 KB
testcase_19 AC 48 ms
50,088 KB
testcase_20 AC 47 ms
50,332 KB
testcase_21 AC 49 ms
50,336 KB
testcase_22 AC 50 ms
50,380 KB
testcase_23 AC 48 ms
50,020 KB
testcase_24 AC 50 ms
50,400 KB
testcase_25 AC 51 ms
50,076 KB
testcase_26 AC 50 ms
50,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No00000113_Main2 {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] arr = br.readLine().split("");
		int x = 0;
		int y = 0;
		for(String s : arr) {
			switch(s) {
			case "N":
				y++;
				break;
			case "E":
				x++;
				break;
			case "W":
				x--;
				break;
			case "S":
				y--;
				break;
			default:
				break;
			}
		}

		System.out.println(Math.sqrt(x * x + y * y));

	}

}
0