結果

問題 No.1286 Stone Skipping
ユーザー 箱星
提出日時 2020-09-30 04:17:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 638 bytes
コンパイル時間 1,763 ms
コンパイル使用メモリ 194,708 KB
最終ジャッジ日時 2025-01-14 23:35:23
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
	for (int i = 0; x > 0 && sum < D; i++)
	{
		sum += x;
		x /= 2;
	}
	return sum;
}

int main()
{
	ll D;
	cin >> D;
	for (ll i = D / 2; i <= D; i++)
	{
		if (func(i, D) == D)
		{
			cout << i << "\n";
			return 0;
		}
	}
}
0