結果
| 問題 |
No.1286 Stone Skipping
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-30 19:14:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 549 bytes |
| コンパイル時間 | 1,593 ms |
| コンパイル使用メモリ | 166,216 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-07 22:20:15 |
| 合計ジャッジ時間 | 2,353 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll d;
ll ok(ll mid, int k) {
ll sum = 0;
while (k--) {
sum += mid;
mid /= 2;
}
return sum;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> d;
ll ans = 1e18;
for (int i = 0; i < 68; i++) {
ll left = 0, right = d;
for (int rep = 0; rep < 60; rep++) {
ll mid = (left + right) / 2;
ll got = ok(mid, i);
if (got >= d)right = mid;
else left = mid;
}
if (ok(right, i) == d) {
ans = min(ans, right);
}
}
cout << ans << endl;
}