結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー h66_34
提出日時 2016-12-26 16:10:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 59,152 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-15 00:08:54
合計ジャッジ時間 1,435 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  int i=0;
  while((N-pow(2,(i+1)))>=0){
    i=i+1;
  }

  if((N-(int)pow(2,i))==0){
    cout << i <<endl;
  }
  else if((N-(int)pow(2,i))==1){
    cout << i+1 <<endl;
  }
  else{
    cout << i+1+(N-(int)pow(2,i))%2 << endl;
  }

  return 0;
}
0