結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー tazakkytazakky
提出日時 2017-08-30 19:50:20
言語 PHP
(8.3.4)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 401 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 30,804 KB
実行使用メモリ 30,980 KB
最終ジャッジ日時 2024-04-24 07:19:28
合計ジャッジ時間 2,060 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
30,788 KB
testcase_01 AC 40 ms
30,784 KB
testcase_02 AC 40 ms
30,776 KB
testcase_03 AC 40 ms
30,972 KB
testcase_04 AC 40 ms
30,896 KB
testcase_05 AC 41 ms
30,540 KB
testcase_06 AC 40 ms
30,788 KB
testcase_07 AC 40 ms
30,584 KB
testcase_08 AC 41 ms
30,896 KB
testcase_09 AC 41 ms
30,564 KB
testcase_10 AC 41 ms
30,648 KB
testcase_11 AC 41 ms
30,680 KB
testcase_12 AC 40 ms
30,712 KB
testcase_13 AC 40 ms
30,972 KB
testcase_14 AC 41 ms
30,688 KB
testcase_15 AC 41 ms
30,812 KB
testcase_16 AC 41 ms
30,692 KB
testcase_17 AC 41 ms
30,664 KB
testcase_18 AC 40 ms
30,892 KB
testcase_19 AC 41 ms
30,644 KB
testcase_20 AC 41 ms
30,700 KB
testcase_21 AC 41 ms
30,980 KB
testcase_22 AC 41 ms
30,376 KB
testcase_23 AC 42 ms
30,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
    $n = trim(fgets(STDIN));
    if($n == 1){
        echo 0;
        exit;
    }
    $b = 1;
    for($i = 1; $i < $n; $i++){
        $b = $b * 2;
        if($b * 2 > $n){
            break;
        }elseif($b == $n){
            $i++;
            break;
        }
    }
    //echo $i."\n";
    //echo $b."\n";
    
    if($n - $b == 0){
        echo $i;
    }else{
        echo $i + 1;
    }
?>
0