結果
| 問題 | No.113 宝探し |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-26 23:41:02 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 55 ms / 5,000 ms |
| + 19µs | |
| コード長 | 708 bytes |
| 記録 | |
| コンパイル時間 | 3,297 ms |
| コンパイル使用メモリ | 85,620 KB |
| 実行使用メモリ | 45,356 KB |
| 最終ジャッジ日時 | 2026-09-25 01:18:59 |
| 合計ジャッジ時間 | 5,685 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
import java.util.Scanner;
public class No113 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String guide = s.next();
char[] c = guide.toCharArray();
int east = 0;
int north = 0;
for (int i = 0; i < c.length; i++) {
if (c[i] == 'N') {
north++;
} else if (c[i] == 'E') {
east++;
} else if (c[i] == 'S') {
north--;
} else if (c[i] == 'W') {
east--;
}
}
east = Math.abs(east);
north = Math.abs(north);
System.out.println(Math.sqrt(east * east + north * north));
}
}