結果

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

ソースコード

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