結果
問題 |
No.113 宝探し
|
ユーザー |
|
提出日時 | 2016-03-31 03:27:29 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 2,225 ms |
コンパイル使用メモリ | 74,552 KB |
実行使用メモリ | 41,764 KB |
最終ジャッジ日時 | 2024-10-02 08:20:49 |
合計ジャッジ時間 | 6,636 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 23 |
ソースコード
import java.util.Scanner; public class Main{ public static void main(String[] args) { // 標準入力から読み込む際に、Scannerオブジェクトを使う。 Scanner sc = new Scanner(System.in); int i=0; char word; double x=0, y=0, kyori=0; int target = sc.nextInt(); //入力する String str=String.valueOf(target); while(i<str.length()) { word=str.charAt(i); if(word=='N') y = y+1; else if(word=='N') y = y-1; else if(word=='E') x = x+1; else if(word=='W') x = x-1; } kyori=Math.sqrt(x*x+y*y); System.out.println(kyori); } }