結果

問題 No.415 ぴょん
ユーザー papinianuspapinianus
提出日時 2016-09-05 12:32:21
言語 PHP
(8.3.4)
結果
AC  
実行時間 39 ms / 1,000 ms
コード長 254 bytes
コンパイル時間 3,188 ms
コンパイル使用メモリ 32,272 KB
実行使用メモリ 31,468 KB
最終ジャッジ日時 2024-04-29 11:43:11
合計ジャッジ時間 5,051 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
31,468 KB
testcase_01 AC 37 ms
30,908 KB
testcase_02 AC 37 ms
31,392 KB
testcase_03 AC 39 ms
31,212 KB
testcase_04 AC 38 ms
31,240 KB
testcase_05 AC 38 ms
30,944 KB
testcase_06 AC 38 ms
31,412 KB
testcase_07 AC 39 ms
30,872 KB
testcase_08 AC 38 ms
30,944 KB
testcase_09 AC 39 ms
31,224 KB
testcase_10 AC 37 ms
31,012 KB
testcase_11 AC 39 ms
31,340 KB
testcase_12 AC 38 ms
31,036 KB
testcase_13 AC 38 ms
31,144 KB
testcase_14 AC 38 ms
31,108 KB
testcase_15 AC 37 ms
31,372 KB
testcase_16 AC 39 ms
31,100 KB
testcase_17 AC 38 ms
31,328 KB
testcase_18 AC 36 ms
31,144 KB
testcase_19 AC 36 ms
31,144 KB
testcase_20 AC 36 ms
31,236 KB
testcase_21 AC 36 ms
31,096 KB
testcase_22 AC 37 ms
31,116 KB
testcase_23 AC 38 ms
31,368 KB
testcase_24 AC 37 ms
31,320 KB
testcase_25 AC 39 ms
31,112 KB
testcase_26 AC 36 ms
31,240 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($ringCnt, $step) = explode(" ", trim(fgets(STDIN)));
$gcd = gcd($ringCnt, $step);
$move = $ringCnt/$gcd - 1;
echo $move.PHP_EOL;

function gcd($x, $y) {
    if($y == 0) {
        return $x;
    } else {
        return gcd($y, $x % $y);
    }
}
0