結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー non
提出日時 2019-03-06 22:53:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 1,474 ms
コンパイル使用メモリ 167,208 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-23 14:39:55
合計ジャッジ時間 2,282 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main()
{
  long long num, count = 0, bis = 1;
  cin >> num;

  while(1)
  {
    int los = num - bis;

    if (los > bis * 2)
    {
      bis = bis * 2;
      count++;
    }
    else
    {
      if (los % 2 == 0)
      {
        cout << count + 1 << endl;
        exit(0);
      }
      else
      {
        cout << count + 2 << endl;
        exit(0);
      }
    }
  }
}
0