結果
問題 |
No.113 宝探し
|
ユーザー |
|
提出日時 | 2015-09-23 20:13:42 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 118 ms / 5,000 ms |
コード長 | 610 bytes |
コンパイル時間 | 3,052 ms |
コンパイル使用メモリ | 74,716 KB |
実行使用メモリ | 41,416 KB |
最終ジャッジ日時 | 2024-11-16 21:00:01 |
合計ジャッジ時間 | 6,855 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
import java.util.Scanner; public class Main_yukicoder113 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); int x = 0; int y = 0; for (char e : s) { switch (e) { case 'N': y++; break; case 'E': x++; break; case 'W': x--; break; case 'S': y--; break; } } System.out.printf("%.3f\n", Math.sqrt(x * x + y * y)); sc.close(); } }