結果

問題 No.358 も~っと!門松列
ユーザー papinianuspapinianus
提出日時 2016-07-28 12:36:24
言語 PHP
(8.3.4)
結果
AC  
実行時間 39 ms / 1,000 ms
コード長 619 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 31,024 KB
実行使用メモリ 31,292 KB
最終ジャッジ日時 2024-04-24 10:31:31
合計ジャッジ時間 1,681 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
31,212 KB
testcase_01 AC 36 ms
31,080 KB
testcase_02 AC 34 ms
30,764 KB
testcase_03 AC 35 ms
31,148 KB
testcase_04 AC 36 ms
30,908 KB
testcase_05 AC 37 ms
31,220 KB
testcase_06 AC 37 ms
30,908 KB
testcase_07 AC 39 ms
31,292 KB
testcase_08 AC 36 ms
30,844 KB
testcase_09 AC 34 ms
30,944 KB
testcase_10 AC 35 ms
31,264 KB
testcase_11 AC 36 ms
31,152 KB
testcase_12 AC 36 ms
31,128 KB
testcase_13 AC 37 ms
31,032 KB
testcase_14 AC 37 ms
31,008 KB
testcase_15 AC 36 ms
31,128 KB
testcase_16 AC 35 ms
31,020 KB
testcase_17 AC 36 ms
31,020 KB
testcase_18 AC 36 ms
31,176 KB
testcase_19 AC 34 ms
31,116 KB
testcase_20 AC 35 ms
31,156 KB
testcase_21 AC 36 ms
31,012 KB
testcase_22 AC 35 ms
31,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$bamboos = explode(" ", trim(fgets(STDIN)));
if(iskadomatsu($bamboos)) {
    echo "INF";
} else {
    $ans = 0;
    if(count(array_unique($bamboos)) == 3) {
        $max = max($bamboos);
        for($i = 2; $i <= $max; $i++) {
            if(isKadomatsu([$bamboos[0]%$i, $bamboos[1]%$i, $bamboos[2]%$i])) {
                $ans++;
            }
        }
    }
    echo $ans;
}
echo PHP_EOL;

function isKadomatsu($arr) {
    if(count(array_unique($arr)) == 3) {
        if(array_keys($arr, max($arr))[0] == 1 || array_keys($arr, min($arr))[0] == 1 ) {
            return true;
        }
    }
    return false;
}
0