結果

問題 No.113 宝探し
ユーザー uafr_csuafr_cs
提出日時 2015-05-15 04:26:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 444 bytes
コンパイル時間 2,441 ms
コンパイル使用メモリ 74,640 KB
実行使用メモリ 41,320 KB
最終ジャッジ日時 2024-04-28 07:23:47
合計ジャッジ時間 5,868 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
40,364 KB
testcase_01 AC 124 ms
41,308 KB
testcase_02 AC 118 ms
41,236 KB
testcase_03 AC 117 ms
41,320 KB
testcase_04 AC 104 ms
39,972 KB
testcase_05 AC 115 ms
41,244 KB
testcase_06 AC 119 ms
41,048 KB
testcase_07 AC 118 ms
40,928 KB
testcase_08 AC 102 ms
40,300 KB
testcase_09 AC 114 ms
41,192 KB
testcase_10 AC 111 ms
40,884 KB
testcase_11 AC 117 ms
41,036 KB
testcase_12 AC 110 ms
41,184 KB
testcase_13 AC 107 ms
40,236 KB
testcase_14 AC 115 ms
41,092 KB
testcase_15 AC 111 ms
41,152 KB
testcase_16 AC 114 ms
40,900 KB
testcase_17 AC 112 ms
40,316 KB
testcase_18 AC 112 ms
41,084 KB
testcase_19 AC 116 ms
41,140 KB
testcase_20 AC 115 ms
40,772 KB
testcase_21 AC 106 ms
40,028 KB
testcase_22 AC 102 ms
39,948 KB
testcase_23 AC 114 ms
40,956 KB
testcase_24 AC 113 ms
39,784 KB
testcase_25 AC 121 ms
41,084 KB
testcase_26 AC 115 ms
40,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int x = 0, y = 0;
		for(char c : sc.next().toCharArray()){
			if(c == 'N'){
				y--;
			}else if(c == 'S'){
				y++;
			}else if(c == 'W'){
				x--;
			}else if(c == 'E'){
				x++;
			}
		}
		
		System.out.printf("%.8f\n", Math.sqrt(x * x + y * y));
	}
	
}
0