結果

問題 No.113 宝探し
ユーザー kamonegi2236kamonegi2236
提出日時 2015-11-14 13:23:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 489 bytes
コンパイル時間 2,870 ms
コンパイル使用メモリ 75,008 KB
実行使用メモリ 41,624 KB
最終ジャッジ日時 2024-04-28 07:31:42
合計ジャッジ時間 6,550 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
41,328 KB
testcase_01 AC 99 ms
41,528 KB
testcase_02 AC 107 ms
41,396 KB
testcase_03 AC 100 ms
39,828 KB
testcase_04 AC 109 ms
41,328 KB
testcase_05 AC 100 ms
41,140 KB
testcase_06 AC 106 ms
41,624 KB
testcase_07 AC 111 ms
41,256 KB
testcase_08 AC 99 ms
41,384 KB
testcase_09 AC 106 ms
41,204 KB
testcase_10 AC 111 ms
41,328 KB
testcase_11 AC 110 ms
41,176 KB
testcase_12 AC 105 ms
41,064 KB
testcase_13 AC 109 ms
41,456 KB
testcase_14 AC 108 ms
40,280 KB
testcase_15 AC 106 ms
41,576 KB
testcase_16 AC 110 ms
41,208 KB
testcase_17 AC 106 ms
41,260 KB
testcase_18 AC 95 ms
41,272 KB
testcase_19 AC 109 ms
41,544 KB
testcase_20 AC 106 ms
41,584 KB
testcase_21 AC 100 ms
40,076 KB
testcase_22 AC 112 ms
41,040 KB
testcase_23 AC 103 ms
41,064 KB
testcase_24 AC 113 ms
41,024 KB
testcase_25 AC 107 ms
41,356 KB
testcase_26 AC 98 ms
41,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No113 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String st = sc.next();
		int NCount =0;
		int ECount =0;
			
		for(int i=0; i<st.length(); i++){
			switch(st.charAt(i)){
			case 'N':
				NCount++;
				break;
			case 'S':
				NCount--;
				break;
			case 'E':
				ECount++;
				break;
			case 'W':
				ECount--;
				break;
			}
		}
		System.out.println(Math.sqrt(Math.pow(ECount,2)+Math.pow(NCount,2)));
	}
}
0