結果

問題 No.113 宝探し
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-10 13:42:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 654 bytes
コンパイル時間 2,102 ms
コンパイル使用メモリ 74,480 KB
実行使用メモリ 41,396 KB
最終ジャッジ日時 2024-04-28 07:19:16
合計ジャッジ時間 5,716 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
41,108 KB
testcase_01 AC 102 ms
40,172 KB
testcase_02 AC 124 ms
41,396 KB
testcase_03 AC 118 ms
41,064 KB
testcase_04 AC 127 ms
41,088 KB
testcase_05 AC 113 ms
41,016 KB
testcase_06 AC 121 ms
40,988 KB
testcase_07 AC 104 ms
39,836 KB
testcase_08 AC 116 ms
41,212 KB
testcase_09 AC 101 ms
40,024 KB
testcase_10 AC 103 ms
39,996 KB
testcase_11 AC 115 ms
40,144 KB
testcase_12 AC 117 ms
40,976 KB
testcase_13 AC 104 ms
40,320 KB
testcase_14 AC 106 ms
39,996 KB
testcase_15 AC 114 ms
39,976 KB
testcase_16 AC 111 ms
41,180 KB
testcase_17 AC 105 ms
40,092 KB
testcase_18 AC 111 ms
41,212 KB
testcase_19 AC 112 ms
41,232 KB
testcase_20 AC 114 ms
41,012 KB
testcase_21 AC 111 ms
40,984 KB
testcase_22 AC 99 ms
40,172 KB
testcase_23 AC 111 ms
41,272 KB
testcase_24 AC 110 ms
40,676 KB
testcase_25 AC 105 ms
40,488 KB
testcase_26 AC 104 ms
40,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        String a = koko.next();
        char[] ah = a.toCharArray();
        double n=0;
        double e=0;
        double w=0;
        double s=0;
        for(int i=0; i<a.length(); i++){
            if(ah[i]=='N'){
                n++;
            }else if(ah[i]=='E'){
                e++;
            }else if(ah[i]=='W'){
                w++;
            }else{
                s++;
            }
        }
        double d=Math.sqrt((n-s)*(n-s)+(e-w)*(e-w));
        System.out.println(d);
    }
}
0