結果
| 問題 |
No.1286 Stone Skipping
|
| コンテスト | |
| ユーザー |
鴨志田卓
|
| 提出日時 | 2023-07-28 06:46:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 644 bytes |
| コンパイル時間 | 1,996 ms |
| コンパイル使用メモリ | 192,728 KB |
| 最終ジャッジ日時 | 2025-02-15 19:44:38 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 2 WA * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
inline i64 lb(i64 x) {return x & (-x);}
i64 check(i64 x, int k)
{
i64 sum = 0;
while (k--)
{
sum += x;
x /= 2;
}
return sum;
}
void solve() {
i64 n, minx;
cin >> n;
minx = n;
double d = 1.0;
for(int i = 2; i <= 61; i ++) {
d += 1.0 / i;
i64 p = n / d;
for(i64 x = p - 100; x <= p + 100; x ++) {
if(check(x, i) == n) minx = min(minx, x);
}
}
cout << minx << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
T = 1;
while(T --)
solve();
}
鴨志田卓