結果
| 問題 |
No.2363 k-bonacci
|
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-05-02 00:47:18 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 736 bytes |
| コンパイル時間 | 3,231 ms |
| コンパイル使用メモリ | 276,936 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-05-02 00:47:24 |
| 合計ジャッジ時間 | 4,798 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
inline bool check(ll n, ll k) {
ll sum = 1;
vector<ll> a(k - 1, 0);
a.push_back(1);
for (int i = k;; ++i) {
a.push_back(sum);
sum -= a[i - k];
sum += a[i];
if (sum > n) return false;
if (sum == n) return true;
}
assert(false);
return false;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll n;
cin >> n;
for (int i = 2; i <= 100; ++i) {
if (check(n, i)) {
cout << i << '\n';
return 0;
}
}
cout << -1 << '\n';
return 0;
}
a01sa01to