結果

問題 No.113 宝探し
ユーザー papinianuspapinianus
提出日時 2016-06-17 11:37:12
言語 PHP
(8.3.4)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 340 bytes
コンパイル時間 1,108 ms
コンパイル使用メモリ 30,792 KB
実行使用メモリ 31,120 KB
最終ジャッジ日時 2024-04-28 07:41:44
合計ジャッジ時間 2,912 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
30,600 KB
testcase_01 AC 38 ms
30,792 KB
testcase_02 AC 35 ms
30,788 KB
testcase_03 AC 35 ms
30,476 KB
testcase_04 AC 34 ms
30,620 KB
testcase_05 AC 35 ms
30,632 KB
testcase_06 AC 36 ms
30,872 KB
testcase_07 AC 37 ms
30,824 KB
testcase_08 AC 36 ms
30,528 KB
testcase_09 AC 35 ms
31,120 KB
testcase_10 AC 36 ms
30,468 KB
testcase_11 AC 36 ms
30,808 KB
testcase_12 AC 35 ms
30,548 KB
testcase_13 AC 37 ms
30,960 KB
testcase_14 AC 35 ms
31,040 KB
testcase_15 AC 34 ms
30,832 KB
testcase_16 AC 37 ms
30,948 KB
testcase_17 AC 36 ms
30,788 KB
testcase_18 AC 36 ms
30,792 KB
testcase_19 AC 36 ms
30,580 KB
testcase_20 AC 36 ms
30,532 KB
testcase_21 AC 36 ms
30,700 KB
testcase_22 AC 36 ms
30,952 KB
testcase_23 AC 35 ms
30,992 KB
testcase_24 AC 35 ms
30,632 KB
testcase_25 AC 34 ms
30,580 KB
testcase_26 AC 37 ms
30,748 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$route = trim(fgets(STDIN));
$across = diffWay($route, 'E','W');
$down = diffWay($route, 'N','S');
$distance = sqrt($across*$across + $down*$down);
echo $distance.PHP_EOL;

function diffWay($path, $one, $another) {
    $one_c = substr_count($path, $one);
    $ano_c = substr_count($path, $another);
    return abs($one_c - $ano_c);
}
0