結果

問題 No.305 鍵(2)
ユーザー papinianuspapinianus
提出日時 2016-09-02 13:03:12
言語 PHP
(8.3.4)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 18,728 KB
実行使用メモリ 35,208 KB
平均クエリ数 44.08
最終ジャッジ日時 2023-09-24 00:29:21
合計ジャッジ時間 1,844 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
34,812 KB
testcase_01 AC 40 ms
34,424 KB
testcase_02 AC 38 ms
35,208 KB
testcase_03 AC 40 ms
34,804 KB
testcase_04 AC 40 ms
34,600 KB
testcase_05 AC 41 ms
34,492 KB
testcase_06 AC 38 ms
34,640 KB
testcase_07 AC 39 ms
35,016 KB
testcase_08 AC 40 ms
34,836 KB
testcase_09 AC 40 ms
35,028 KB
testcase_10 AC 39 ms
34,984 KB
testcase_11 AC 40 ms
34,648 KB
testcase_12 AC 38 ms
34,860 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$digit = [0,1,2,3,4,5,6,7,8,9];
$trial = array_fill(0, 10, 0);
$pos = 0;

echo implode("", $trial).PHP_EOL;
flush();
list($prev, $stat) = explode(" ", trim(fgets(STDIN)));
$trial[$pos] = ($trial[$pos] + 1) % 10;
while($stat == "locked" && $pos < 10) {
    echo implode("", $trial).PHP_EOL;
    flush();
    list($n, $stat) = explode(" ", trim(fgets(STDIN)));
    if($n > $prev) {
        $pos++;
        $prev = $n;
    } else if ($prev > $n) {
        $trial[$pos] = ($trial[$pos] + 9) % 10;
        $pos++;
    } else {
        $prev = $n;
    }
    $trial[$pos] = ($trial[$pos] + 1) % 10;
}
0