結果

問題 No.113 宝探し
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-14 11:50:22
言語 PHP
(8.3.4)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 234 bytes
コンパイル時間 932 ms
コンパイル使用メモリ 31,048 KB
実行使用メモリ 31,364 KB
最終ジャッジ日時 2024-04-28 07:57:47
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
30,848 KB
testcase_01 AC 35 ms
31,152 KB
testcase_02 AC 36 ms
31,264 KB
testcase_03 AC 35 ms
30,968 KB
testcase_04 AC 34 ms
30,940 KB
testcase_05 AC 34 ms
31,232 KB
testcase_06 AC 35 ms
31,072 KB
testcase_07 AC 35 ms
31,136 KB
testcase_08 AC 35 ms
31,256 KB
testcase_09 AC 34 ms
31,044 KB
testcase_10 AC 34 ms
31,212 KB
testcase_11 AC 35 ms
30,868 KB
testcase_12 AC 35 ms
31,068 KB
testcase_13 AC 41 ms
30,964 KB
testcase_14 AC 34 ms
31,056 KB
testcase_15 AC 35 ms
31,048 KB
testcase_16 AC 35 ms
30,852 KB
testcase_17 AC 37 ms
31,152 KB
testcase_18 AC 38 ms
31,040 KB
testcase_19 AC 37 ms
31,064 KB
testcase_20 AC 36 ms
31,132 KB
testcase_21 AC 37 ms
31,004 KB
testcase_22 AC 36 ms
31,156 KB
testcase_23 AC 42 ms
31,188 KB
testcase_24 AC 36 ms
30,988 KB
testcase_25 AC 36 ms
31,364 KB
testcase_26 AC 35 ms
30,912 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$s = trim(fgets(STDIN));
$x = 0;
$y = 0;
for($i = 0; $i < strlen($s); $i++) {
  $n = substr($s, $i, 1);
  if($n == 'N') $y++;
  if($n == 'E') $x++;
  if($n == 'W') $x--;
  if($n == 'S') $y--;
}
print(sqrt($x * $x + $y * $y));
?>
0