結果
問題 | No.113 宝探し |
ユーザー | 37zigen |
提出日時 | 2016-03-31 18:53:10 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 117 ms / 5,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 2,424 ms |
コンパイル使用メモリ | 74,576 KB |
実行使用メモリ | 41,324 KB |
最終ジャッジ日時 | 2024-11-16 21:13:34 |
合計ジャッジ時間 | 5,700 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
package yukicoder113; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); double x=0; double y=0; String str=sc.next(); char[] c=str.toCharArray(); for(int i=0;i<c.length;i++){ if(c[i]=='N'){ y++; }else if(c[i]=='S'){ y--; }else if(c[i]=='W'){ x--; }else if(c[i]=='E'){ x++; } } System.out.println(Math.sqrt(x*x+y*y)); } }