結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー d_nishiyama85d_nishiyama85
提出日時 2016-05-25 10:35:36
言語 PHP
(8.3.4)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 217 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 31,076 KB
実行使用メモリ 31,560 KB
最終ジャッジ日時 2024-04-16 16:32:33
合計ジャッジ時間 1,974 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
31,268 KB
testcase_01 AC 41 ms
31,324 KB
testcase_02 AC 41 ms
31,172 KB
testcase_03 AC 41 ms
31,348 KB
testcase_04 AC 41 ms
31,148 KB
testcase_05 AC 41 ms
31,368 KB
testcase_06 AC 41 ms
31,284 KB
testcase_07 AC 41 ms
31,236 KB
testcase_08 AC 41 ms
31,132 KB
testcase_09 AC 42 ms
31,016 KB
testcase_10 AC 41 ms
30,928 KB
testcase_11 AC 41 ms
31,560 KB
testcase_12 AC 40 ms
31,152 KB
testcase_13 AC 41 ms
31,168 KB
testcase_14 AC 40 ms
31,200 KB
testcase_15 AC 41 ms
31,168 KB
testcase_16 AC 41 ms
31,112 KB
testcase_17 AC 41 ms
31,212 KB
testcase_18 AC 40 ms
31,192 KB
testcase_19 AC 40 ms
31,144 KB
testcase_20 AC 41 ms
31,324 KB
testcase_21 AC 42 ms
31,336 KB
testcase_22 AC 42 ms
31,432 KB
testcase_23 AC 41 ms
31,328 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$N = (int)fgets(STDIN);

$pow = 0;
$digit = 0;
$bin = 1;
$n = $N;
while ($n > 1) {
    $pow++;
    $n = (int)($n/2);
    $bin *= 2;
}

if ($N === $bin) {
    echo "$pow\n";
} else {
    echo ($pow + 1) . "\n";
}
0