結果

問題 No.113 宝探し
ユーザー カニ戯(ryカニ戯(ry
提出日時 2015-02-25 10:27:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 142 ms / 5,000 ms
コード長 287 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 41,812 KB
最終ジャッジ日時 2024-04-28 07:16:35
合計ジャッジ時間 6,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,264 KB
testcase_01 AC 134 ms
41,352 KB
testcase_02 AC 134 ms
41,136 KB
testcase_03 AC 132 ms
39,936 KB
testcase_04 AC 138 ms
41,492 KB
testcase_05 AC 134 ms
41,208 KB
testcase_06 AC 139 ms
41,388 KB
testcase_07 AC 131 ms
41,660 KB
testcase_08 AC 127 ms
41,724 KB
testcase_09 AC 129 ms
41,092 KB
testcase_10 AC 135 ms
41,212 KB
testcase_11 AC 128 ms
41,240 KB
testcase_12 AC 118 ms
40,156 KB
testcase_13 AC 135 ms
41,552 KB
testcase_14 AC 133 ms
41,420 KB
testcase_15 AC 134 ms
41,288 KB
testcase_16 AC 131 ms
41,204 KB
testcase_17 AC 132 ms
41,300 KB
testcase_18 AC 129 ms
41,236 KB
testcase_19 AC 130 ms
41,392 KB
testcase_20 AC 132 ms
41,520 KB
testcase_21 AC 142 ms
41,188 KB
testcase_22 AC 138 ms
41,560 KB
testcase_23 AC 132 ms
41,404 KB
testcase_24 AC 131 ms
41,812 KB
testcase_25 AC 130 ms
41,652 KB
testcase_26 AC 132 ms
41,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] a) {
		Scanner s = new Scanner(System.in);
		int x=0,y=0;
		for(char c:s.nextLine().toCharArray()){
			x+=c=='W'?-1:c=='E'?1:0;
			y+=c=='N'?-1:c=='S'?1:0;
		}
		System.out.println(Math.sqrt(x*x+y*y));
	}
}
0