結果

問題 No.113 宝探し
ユーザー kou6839kou6839
提出日時 2014-12-29 17:04:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 503 bytes
コンパイル時間 2,364 ms
コンパイル使用メモリ 78,856 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-04-28 07:13:38
合計ジャッジ時間 6,665 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,356 KB
testcase_01 AC 128 ms
41,436 KB
testcase_02 AC 111 ms
40,160 KB
testcase_03 AC 127 ms
41,432 KB
testcase_04 AC 130 ms
41,416 KB
testcase_05 AC 130 ms
41,256 KB
testcase_06 AC 129 ms
41,116 KB
testcase_07 AC 127 ms
41,456 KB
testcase_08 AC 126 ms
41,416 KB
testcase_09 AC 134 ms
41,356 KB
testcase_10 AC 131 ms
41,220 KB
testcase_11 AC 134 ms
41,144 KB
testcase_12 AC 128 ms
41,708 KB
testcase_13 AC 125 ms
41,176 KB
testcase_14 AC 126 ms
41,336 KB
testcase_15 AC 129 ms
41,416 KB
testcase_16 AC 126 ms
41,268 KB
testcase_17 AC 133 ms
41,552 KB
testcase_18 AC 130 ms
41,224 KB
testcase_19 AC 131 ms
41,176 KB
testcase_20 AC 117 ms
39,976 KB
testcase_21 AC 132 ms
41,528 KB
testcase_22 AC 133 ms
41,420 KB
testcase_23 AC 131 ms
40,988 KB
testcase_24 AC 117 ms
40,168 KB
testcase_25 AC 128 ms
41,376 KB
testcase_26 AC 116 ms
40,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String ss = sc.next();
        int ue =0;
        int migi=0;
        for(int i=0;i<ss.length();i++){
        	if(ss.charAt(i)=='N') ue++;
        	if(ss.charAt(i)=='S') ue--;
        	if(ss.charAt(i)=='E') migi++;
        	if(ss.charAt(i)=='W') migi--;
        }
        System.out.println(Math.sqrt(Math.pow(ue, 2)+Math.pow(migi, 2)));
        
    }
}
0