結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー Shawn stayC
提出日時 2020-05-17 11:02:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 1,397 ms
コンパイル使用メモリ 165,836 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 01:44:10
合計ジャッジ時間 2,116 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int N; cin>>N;
    int i=1; int cnt=0;
	while(i<N){
		i*=2; cnt++;
        if(i*2>N) break;
	}
	if(pow(2,cnt)==N) cout << cnt << endl;
	else if(N%2==0) cout << cnt+1 << endl;
	else if(N%2==1) cout << cnt+2 << endl;
}
0