結果
問題 | No.954 Result |
ユーザー |
|
提出日時 | 2019-12-23 01:11:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 697 bytes |
コンパイル時間 | 1,397 ms |
コンパイル使用メモリ | 169,364 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 12:38:28 |
合計ジャッジ時間 | 2,297 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 7 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); array<ll, 5> a{}; for (int i = 4; i >= 0; --i) { cin >> a[i]; } vector<ll> v; v.push_back(1); v.push_back(1); for (int i = 2; ; ++i) { v.push_back(v[i - 2] + v[i - 1]); if (v.back() > 1000000000000000LL) { v.pop_back(); break; } } int ans = 0; for (int i = 0; i + 5 <= v.size(); ++i) { for (int j = 0; j < 5; ++j) { if (v[i + j] != a[j]) break; ans = max(ans, j + 1); } } cout << ans << "\n"; return 0; }