結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
fkwnw3_1243
|
| 提出日時 | 2017-04-29 06:58:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 829 bytes |
| コンパイル時間 | 2,491 ms |
| コンパイル使用メモリ | 74,560 KB |
| 実行使用メモリ | 50,452 KB |
| 最終ジャッジ日時 | 2024-09-13 19:05:26 |
| 合計ジャッジ時間 | 5,244 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 12 WA * 11 |
ソースコード
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String S = reader.readLine();
int x = 0;
int y = 0;
for (int i = 0; i < S.length(); i++) {
switch (S.charAt(i)) {
case 'N':
y += 1;
break;
case 'E':
x += 1;
break;
case 'W':
y -= 1;
break;
case 'S':
x -= 1;
break;
}
}
System.out.println(Math.sqrt(x*x + y*y));
}
}
fkwnw3_1243