結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー ふーらくたる
提出日時 2016-07-29 01:45:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 303 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 55,772 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 18:18:47
合計ジャッジ時間 1,208 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
    int N;
    cin >> N;

    int cookie = 1, times = 0;
    if (N > 1 && N % 2 == 1) {
        N--;
        times++;
    }

    while (cookie * 2 <= N) {
        cookie *= 2;
        times++;
    }

    cout << times + (N - cookie > 0) << endl;
}
0