結果
問題 |
No.113 宝探し
|
ユーザー |
![]() |
提出日時 | 2015-05-15 08:13:08 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 126 ms / 5,000 ms |
コード長 | 335 bytes |
コンパイル時間 | 3,759 ms |
コンパイル使用メモリ | 74,440 KB |
実行使用メモリ | 41,424 KB |
最終ジャッジ日時 | 2024-11-16 20:55:06 |
合計ジャッジ時間 | 7,122 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
import java.util.Scanner; public class No113 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); int x=0,y=0; for(int i=0;i<s.length;i++){ y+=s[i]=='N'?1:s[i]=='S'?-1:0; x+=s[i]=='E'?1:s[i]=='W'?-1:0; } System.out.println(Math.sqrt((x*x)+(y*y))); } }