結果
問題 | No.1286 Stone Skipping |
ユーザー |
![]() |
提出日時 | 2020-11-21 00:09:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 590 bytes |
コンパイル時間 | 2,126 ms |
コンパイル使用メモリ | 192,196 KB |
最終ジャッジ日時 | 2025-01-16 03:38:51 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll d; cin >> d; for (ll i = 100; i >= 1; i--) { ll left = 0, right = 1e18; while (left + 1 < right) { ll mid = (left + right) / 2, keep = mid, now = 0; for (ll j = 0; j < i; j++) { now += keep; keep /= 2; } if (now >= d) right = mid; else left = mid; } ll now = 0, right2 = right; for (ll j = 0; j < i; j++) { now += right2; right2 /= 2; } if (now == d) { cout << right << '\n'; return 0; } } }