結果
問題 |
No.1286 Stone Skipping
|
ユーザー |
![]() |
提出日時 | 2020-11-20 23:57:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 620 bytes |
コンパイル時間 | 1,776 ms |
コンパイル使用メモリ | 193,340 KB |
最終ジャッジ日時 | 2025-01-16 03:33:15 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 WA * 2 |
ソースコード
#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; } for (ll i = right; i < right + 1e7; i++) { ll keep = i, now2 = 0; while (keep > 0) { now2 += keep; keep /= 2; if (now2 == d) { cout << i << '\n'; return 0; } else if (now2 > d) break; } } cout << d << '\n'; }