結果
問題 |
No.113 宝探し
|
ユーザー |
|
提出日時 | 2015-08-10 02:53:55 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 115 ms / 5,000 ms |
コード長 | 783 bytes |
コンパイル時間 | 3,021 ms |
コンパイル使用メモリ | 77,676 KB |
実行使用メモリ | 41,592 KB |
最終ジャッジ日時 | 2024-11-16 20:58:36 |
合計ジャッジ時間 | 6,931 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 23 |
ソースコード
import java.util.*; public class searchBox{ public static void main(String... args){ Scanner scan = new Scanner(System.in); String point = scan.next(); DoSearch(point); } public static void DoSearch(String point){ int[] count_point = {0,0,0,0};//N,E,W,S for(int i = 0; i < point.length(); i++){ String now = point.substring(i,i+1); if(now.equals("N")){ count_point[0]+=1; }else if(now.equals("E")){ count_point[1]+=1; }else if(now.equals("W")){ count_point[2]+=1; }else{ count_point[3]+=1; } } int[] right = {count_point[1],count_point[0]};//x,y int[] left = {count_point[2]*(-1),count_point[3]*(-1)}; double x = Math.pow(right[0]+left[0],2); double y = Math.pow(right[1]+left[1],2); System.out.println(Math.sqrt(x+y)); } }