結果

問題 No.1286 Stone Skipping
ユーザー Example0911
提出日時 2020-11-13 21:43:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 1,879 ms
コンパイル使用メモリ 192,512 KB
最終ジャッジ日時 2025-01-15 22:43:59
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	long long d; cin >> d;
	long long tmp = d / 2 - 1;
	for (long long i = tmp; i < tmp + 1000000; i++) {
		long long now = i;
		if (now == d) {
			cout << i << endl; return 0;
		}
		long long a = i;
		while (a > 0) {
			now += a / 2;
			if (now == d) {
				cout << i << endl; return 0;
			}
			a /= 2;
		}
		now += a;
		if (now == d) {
			cout << i << endl; return 0;
		}
	}
	cout << d << endl;
	return 0;
}
0