結果
問題 | No.3 ビットすごろく |
ユーザー | jake_taro |
提出日時 | 2015-09-07 15:26:34 |
言語 | PHP (8.3.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 74 ms |
コンパイル使用メモリ | 18,580 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2023-09-26 10:00:20 |
合計ジャッジ時間 | 1,909 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
18,700 KB |
testcase_01 | AC | 16 ms
18,856 KB |
testcase_02 | AC | 16 ms
18,864 KB |
testcase_03 | AC | 17 ms
18,852 KB |
testcase_04 | AC | 16 ms
18,864 KB |
testcase_05 | AC | 17 ms
18,916 KB |
testcase_06 | AC | 17 ms
18,852 KB |
testcase_07 | AC | 16 ms
18,760 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 17 ms
19,016 KB |
testcase_13 | AC | 17 ms
18,764 KB |
testcase_14 | AC | 16 ms
18,852 KB |
testcase_15 | AC | 17 ms
18,844 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 16 ms
18,888 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 16 ms
18,796 KB |
testcase_22 | AC | 17 ms
18,860 KB |
testcase_23 | AC | 17 ms
18,840 KB |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 16 ms
18,828 KB |
testcase_32 | WA | - |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $N = (int)trim(fgets(STDIN)); // マス数N $start = 1; //スタート地点 $count = 0; //移動回数 do{ if($N == 1){ echo 0,PHP_EOL; exit; } $number_2 = decbin($start); //2進数表記 $shift = substr_count($number_2, "1"); $start += $shift; if($start > $N){ $start -= 2 * $shift; } $count++; # echo $start, PHP_EOL; if($count > 3000){ echo -1, PHP_EOL; exit; } }while($start < $N); echo $count + 1, PHP_EOL;