結果

問題 No.113 宝探し
ユーザー rf141rf141
提出日時 2015-08-10 02:56:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 509 bytes
コンパイル時間 2,836 ms
コンパイル使用メモリ 74,672 KB
実行使用メモリ 54,216 KB
最終ジャッジ日時 2024-04-28 07:27:18
合計ジャッジ時間 6,634 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
52,716 KB
testcase_01 AC 98 ms
53,108 KB
testcase_02 AC 115 ms
54,216 KB
testcase_03 AC 102 ms
52,848 KB
testcase_04 AC 114 ms
54,136 KB
testcase_05 AC 111 ms
53,652 KB
testcase_06 AC 109 ms
53,996 KB
testcase_07 AC 115 ms
53,992 KB
testcase_08 AC 117 ms
53,852 KB
testcase_09 AC 97 ms
52,996 KB
testcase_10 AC 113 ms
53,848 KB
testcase_11 AC 113 ms
53,884 KB
testcase_12 AC 108 ms
53,752 KB
testcase_13 AC 115 ms
53,624 KB
testcase_14 AC 102 ms
54,000 KB
testcase_15 AC 111 ms
53,996 KB
testcase_16 AC 116 ms
53,748 KB
testcase_17 AC 106 ms
54,004 KB
testcase_18 AC 110 ms
53,848 KB
testcase_19 AC 112 ms
53,720 KB
testcase_20 AC 102 ms
53,272 KB
testcase_21 AC 100 ms
53,096 KB
testcase_22 AC 110 ms
54,140 KB
testcase_23 AC 100 ms
53,088 KB
testcase_24 AC 109 ms
53,708 KB
testcase_25 AC 109 ms
53,460 KB
testcase_26 AC 99 ms
52,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class searchBox{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		String point = scan.next();
		DoSearch(point);
	}
	public static void DoSearch(String point){
		double x=0,y=0;
		for(int i = 0; i < point.length(); i++){
			String now = point.substring(i,i+1);
			if(now.equals("N")){
				y++;
			}else if(now.equals("E")){
				x++;
			}else if(now.equals("W")){
				x--;
			}else{
				y--;
			}
		}
		System.out.println(Math.sqrt(x*x+y*y));
	}
}
0