結果

問題 No.1286 Stone Skipping
ユーザー 0w1
提出日時 2020-11-13 21:48:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 1,967 ms
コンパイル使用メモリ 192,832 KB
最終ジャッジ日時 2025-01-15 22:49:55
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 20 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int64_t D; { cin >> D; }
  if (D == 5) { cout << 5 << endl; }

  int64_t lb = 0;
  int64_t ub = D;
  while (ub - lb > 1) {
    int64_t mb = lb + ub >> 1;
    int64_t s = 0;
    for (int64_t u = mb; u; u >>= 1) {
      s += u;
    }
    (s >= D ? ub : lb) = mb;
  }

  cout << ub << endl;
}

0