結果

問題 No.113 宝探し
ユーザー shinwisteriashinwisteria
提出日時 2018-03-04 13:53:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 3,433 ms
コンパイル使用メモリ 74,584 KB
実行使用メモリ 41,344 KB
最終ジャッジ日時 2024-04-28 08:09:12
合計ジャッジ時間 6,290 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
40,092 KB
testcase_01 AC 109 ms
41,100 KB
testcase_02 AC 104 ms
40,792 KB
testcase_03 AC 108 ms
40,948 KB
testcase_04 AC 106 ms
40,312 KB
testcase_05 AC 90 ms
39,964 KB
testcase_06 AC 98 ms
40,340 KB
testcase_07 AC 110 ms
40,596 KB
testcase_08 AC 112 ms
39,964 KB
testcase_09 AC 92 ms
40,500 KB
testcase_10 AC 95 ms
39,836 KB
testcase_11 AC 117 ms
40,976 KB
testcase_12 AC 109 ms
41,076 KB
testcase_13 AC 99 ms
40,768 KB
testcase_14 AC 96 ms
41,072 KB
testcase_15 AC 108 ms
40,980 KB
testcase_16 AC 97 ms
40,188 KB
testcase_17 AC 97 ms
41,000 KB
testcase_18 AC 102 ms
40,988 KB
testcase_19 AC 103 ms
41,200 KB
testcase_20 AC 98 ms
41,344 KB
testcase_21 AC 89 ms
39,572 KB
testcase_22 AC 99 ms
40,252 KB
testcase_23 AC 85 ms
39,664 KB
testcase_24 AC 102 ms
41,040 KB
testcase_25 AC 89 ms
39,996 KB
testcase_26 AC 99 ms
40,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.Scanner;
public class Con113 {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String root = s.next();
		s.close();

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

}
0