結果

問題 No.113 宝探し
ユーザー FVRChanFVRChan
提出日時 2017-09-24 15:36:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 390 bytes
コンパイル時間 2,152 ms
コンパイル使用メモリ 74,356 KB
実行使用メモリ 54,300 KB
最終ジャッジ日時 2024-04-28 07:59:59
合計ジャッジ時間 6,669 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
53,920 KB
testcase_01 AC 129 ms
53,640 KB
testcase_02 AC 127 ms
53,752 KB
testcase_03 AC 130 ms
53,952 KB
testcase_04 AC 129 ms
53,712 KB
testcase_05 AC 132 ms
54,300 KB
testcase_06 AC 129 ms
53,872 KB
testcase_07 AC 129 ms
53,616 KB
testcase_08 AC 130 ms
54,196 KB
testcase_09 AC 124 ms
41,276 KB
testcase_10 AC 128 ms
40,640 KB
testcase_11 AC 130 ms
40,856 KB
testcase_12 AC 126 ms
40,744 KB
testcase_13 AC 130 ms
40,984 KB
testcase_14 AC 127 ms
41,424 KB
testcase_15 AC 126 ms
41,128 KB
testcase_16 AC 114 ms
39,656 KB
testcase_17 AC 132 ms
40,680 KB
testcase_18 AC 128 ms
40,876 KB
testcase_19 AC 130 ms
40,920 KB
testcase_20 AC 133 ms
41,292 KB
testcase_21 AC 131 ms
41,268 KB
testcase_22 AC 132 ms
41,072 KB
testcase_23 AC 128 ms
40,764 KB
testcase_24 AC 127 ms
41,056 KB
testcase_25 AC 133 ms
40,864 KB
testcase_26 AC 132 ms
41,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	public static void main(String args[])throws Exception{
		Scanner sc=new Scanner(System.in);
		char c[]=sc.nextLine().toCharArray();
		int x=0,y=0;

		for(int i=0;i<c.length;i++){
			switch(c[i]){
			case'N':y--;break;
			case'E':x++;break;
			case'S':y++;break;
			case'W':x--;break;
			}
		}
		System.out.println(Math.sqrt((x*x)+(y*y)));
	}
}
0