結果

問題 No.113 宝探し
ユーザー GoryudyumaGoryudyuma
提出日時 2015-03-08 02:56:45
言語 PHP
(8.3.4)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 293 bytes
コンパイル時間 1,224 ms
コンパイル使用メモリ 32,272 KB
実行使用メモリ 31,168 KB
最終ジャッジ日時 2024-04-28 07:16:40
合計ジャッジ時間 2,870 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
31,168 KB
testcase_01 AC 33 ms
30,848 KB
testcase_02 AC 36 ms
30,560 KB
testcase_03 AC 34 ms
30,620 KB
testcase_04 AC 32 ms
30,848 KB
testcase_05 AC 33 ms
30,856 KB
testcase_06 AC 33 ms
30,924 KB
testcase_07 AC 31 ms
30,728 KB
testcase_08 AC 32 ms
30,948 KB
testcase_09 AC 33 ms
30,644 KB
testcase_10 AC 34 ms
30,924 KB
testcase_11 AC 35 ms
30,880 KB
testcase_12 AC 33 ms
30,836 KB
testcase_13 AC 34 ms
30,580 KB
testcase_14 AC 35 ms
30,724 KB
testcase_15 AC 34 ms
30,856 KB
testcase_16 AC 33 ms
30,848 KB
testcase_17 AC 34 ms
30,880 KB
testcase_18 AC 33 ms
30,732 KB
testcase_19 AC 33 ms
30,752 KB
testcase_20 AC 34 ms
30,724 KB
testcase_21 AC 34 ms
30,528 KB
testcase_22 AC 33 ms
30,956 KB
testcase_23 AC 35 ms
31,088 KB
testcase_24 AC 33 ms
30,952 KB
testcase_25 AC 34 ms
30,508 KB
testcase_26 AC 35 ms
31,004 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$S=  trim(fgets(STDIN));
$ans=array(0,0);
for($i=0;$i<strlen($S);$i++){
    switch ($S[$i]){
        case 'E' :$ans[0]++;break;
        case 'W':$ans[0]--;break;
        case 'N':$ans[1]++;break;
        case 'S':$ans[1]--;break;
    }
}
echo sqrt(pow($ans[0],2)+pow($ans[1],2)).PHP_EOL;
0