結果
| 問題 |
No.113 宝探し
|
| コンテスト | |
| ユーザー |
ki_ki33
|
| 提出日時 | 2014-12-28 23:28:04 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 128 ms / 5,000 ms |
| コード長 | 1,358 bytes |
| コンパイル時間 | 2,021 ms |
| コンパイル使用メモリ | 75,852 KB |
| 実行使用メモリ | 41,332 KB |
| 最終ジャッジ日時 | 2024-11-16 20:34:58 |
| 合計ジャッジ時間 | 5,952 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
import java.io.BufferedInputStream;
import java.io.IOException;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static final int C = 1000000007;
//static int map[][];
static int N;
//static int M;
//static int tic[][];
//static int dp[][];
//static int max;
static int B[];
//static int p[];
//static ArrayList<HashSet<Integer>> al;
static ArrayList<Integer> al;
//static int a[][];
//static char[][] ch;
//static ArrayList<HashMap<Long, Long>> al;
//static String a[];
//static String str;
//static int[] mach = new int[] {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
public static void main(String[] args) {
//StringBuilder sb = new StringBuilder();
BufferedInputStream bs = new BufferedInputStream(System.in);
Scanner sc = new Scanner(bs);
//String str = sc.next();
String str = sc.next();
double ans = 0;
double w = 0;
double h = 0;
for (int i=0; i < str.length(); i++) {
switch(str.charAt(i)) {
case 'N':
h++;
break;
case 'S':
h--;
break;
case 'E':
w++;
break;
case 'W':
w--;
break;
}
}
ans = Math.hypot(h, w);
System.out.println(ans);
/*if (ans) {
System.out.println("YES");
}else{
System.out.println("NO");
}*/
}
}
ki_ki33