結果
| 問題 | No.1286 Stone Skipping |
| コンテスト | |
| ユーザー |
mine691
|
| 提出日時 | 2020-09-30 05:06:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 683 bytes |
| コンパイル時間 | 1,788 ms |
| コンパイル使用メモリ | 194,368 KB |
| 最終ジャッジ日時 | 2025-01-14 23:37:13 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
constexpr int mod = 1e9 + 7;
constexpr int inf = (1 << 30) - 1;
constexpr ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)
#define set_digit(N) cout << fixed << setprecision((N))
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
ll func(ll x, ll D)
{
ll sum = 0;
while (x > 0 && sum < D)
{
sum += x;
x /= 2;
}
return sum;
}
int main()
{
ll D;
cin >> D;
ll mi = max((ll)1, D / 2 - 50000000);
for (ll i = mi; i <= min(D, D / 2 + 50000000); i++)
{
if (func(i, D) == D)
{
cout << i << "\n";
return 0;
}
}
}
mine691