結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー vrjfsyi
提出日時 2018-04-10 07:32:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 544 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 66,724 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 20:52:11
合計ジャッジ時間 1,426 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <array>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;

long pow(long x, int n) {
    long ans = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x;
        }
        x = x * x;
        n = n >> 1;
    }
    return ans;
}

long f(long x) {
    return pow(2,x);
}

int main() {

    long N;
    cin >> N;

    int k = 0;
    while (f(k) < N) {
        k += 1;
    }

    cout << k << "\n";

}
0