結果
問題 |
No.954 Result
|
ユーザー |
|
提出日時 | 2020-04-19 20:50:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 743 bytes |
コンパイル時間 | 987 ms |
コンパイル使用メモリ | 77,556 KB |
最終ジャッジ日時 | 2025-01-09 21:44:48 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 7 |
other | AC * 29 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using lint = long long; constexpr lint INF = 1LL << 50; void solve() { std::vector<lint> fib{1, 1}; while (fib.back() < INF) { fib.push_back(fib[fib.size() - 1] + fib[fib.size() - 2]); } int m = fib.size(); std::vector<lint> xs(5); for (auto& x : xs) std::cin >> x; std::reverse(xs.begin(), xs.end()); int ans = 0; for (int i = 0; i + 5 <= m; ++i) { for (int j = 0; j < 5; ++j) { if (xs[j] != fib[j + i]) break; ans = std::max(ans, j + 1); } } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }