結果

問題 No.313 π
ユーザー YuzunohaYuzunoha
提出日時 2018-05-29 02:22:40
言語 PHP
(8.3.4)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 815 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 12,060 KB
実行使用メモリ 12,448 KB
最終ジャッジ日時 2023-09-12 20:21:44
合計ジャッジ時間 2,251 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
12,340 KB
testcase_01 AC 18 ms
12,388 KB
testcase_02 AC 18 ms
12,412 KB
testcase_03 AC 18 ms
12,376 KB
testcase_04 AC 17 ms
12,348 KB
testcase_05 AC 18 ms
12,312 KB
testcase_06 AC 18 ms
12,408 KB
testcase_07 AC 17 ms
12,372 KB
testcase_08 AC 18 ms
12,292 KB
testcase_09 AC 18 ms
12,324 KB
testcase_10 AC 18 ms
12,420 KB
testcase_11 AC 18 ms
12,388 KB
testcase_12 AC 18 ms
12,304 KB
testcase_13 AC 18 ms
12,372 KB
testcase_14 AC 18 ms
12,308 KB
testcase_15 AC 18 ms
12,312 KB
testcase_16 AC 18 ms
12,392 KB
testcase_17 AC 17 ms
12,312 KB
testcase_18 AC 18 ms
12,388 KB
testcase_19 AC 18 ms
12,408 KB
testcase_20 AC 18 ms
12,372 KB
testcase_21 AC 17 ms
12,432 KB
testcase_22 AC 18 ms
12,372 KB
testcase_23 AC 17 ms
12,308 KB
testcase_24 AC 17 ms
12,444 KB
testcase_25 AC 18 ms
12,444 KB
testcase_26 AC 17 ms
12,388 KB
testcase_27 AC 17 ms
12,312 KB
testcase_28 AC 18 ms
12,372 KB
testcase_29 AC 17 ms
12,448 KB
testcase_30 AC 17 ms
12,316 KB
testcase_31 AC 18 ms
12,388 KB
testcase_32 AC 18 ms
12,412 KB
testcase_33 AC 17 ms
12,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

function calcKey_TooManyAndTooLittle($a, $b)
{
    for ($i = 0; $i < 10; $i++) {
        if ($a[$i] < $b[$i]) {
            $tooMany = $i;
        }
        if ($a[$i] > $b[$i]) {
            $tooLittle = $i;
        }
    }
    return [
        "tooMany" => $tooMany,
        "tooLittle" => $tooLittle,
    ];
}

function sub()
{
    $a[0] = 20104;
    $a[1] = 20063;
    $a[2] = 19892;
    $a[3] = 20011;
    $a[4] = 19874;
    $a[5] = 20199;
    $a[6] = 19898;
    $a[7] = 20163;
    $a[8] = 19956;
    $a[9] = 19841;

    $in = trim(fgets(STDIN));
    $len = strlen($in);
    $b = [];

    for ($i = 0; $i < $len; $i++) {
        if(ctype_digit($in[$i])){
            $b[$in[$i]]++;
        }
    }

    $c = calcKey_TooManyAndTooLittle($a, $b);

    echo $c["tooMany"] . " " . $c["tooLittle"];
}

sub();
0