結果
問題 | No.1286 Stone Skipping |
ユーザー |
![]() |
提出日時 | 2020-11-20 23:51:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 528 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 191,860 KB |
最終ジャッジ日時 | 2025-01-16 03:28:55 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll d; cin >> d; ll left = 0, right = 1e18; while (left + 1 < right) { ll mid = (left + right) / 2; ll now = mid, acc = 0; while (now > 0) { acc += now; now /= 2; } if (acc >= d) right = mid; else left = mid; } ll keep = right, now2 = 0; while (keep > 0) { now2 += keep; keep /= 2; if (now2 == d) break; } if (now2 == d) cout << right << '\n'; else cout << d << '\n'; }