結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー kimagureman
提出日時 2016-02-15 10:06:17
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 344 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 59,964 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 06:46:01
合計ジャッジ時間 1,268 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int ruijo(int a, int max, int* pN)
{
	if (a*2 > max) return a;
	++ (*pN);
	return ruijo(a*2, max, pN);
}

int main(int argc, char**argv)
{
	int n;
	cin >> n;

	int num = 0;
	int max = ruijo(1, n, &num);
	if (n-max > 0) num ++;

	cout << num << endl;
	return 0;
}
0