結果
| 問題 |
No.954 Result
|
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-09-02 04:47:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 731 bytes |
| コンパイル時間 | 2,127 ms |
| コンパイル使用メモリ | 181,608 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-04 13:04:08 |
| 合計ジャッジ時間 | 2,579 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 7 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
unordered_map<ll, ll> m;
set<ll> st;
ll f(ll n)
{
if (n == 0 || n == 1)
{
m[n] = 1;
st.insert(1);
return 1;
}
auto it = m.find(n);
if (it != m.end())
return m[n];
ll res = f(n - 1) + f(n - 2);
m[n] = res;
st.insert(res);
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<ll> a(5);
for (auto&& ia : a)
cin >> ia;
f(72);
int res{ 0 };
auto it = st.find(a[4]);
if (it != st.end())
{
for (int i = 4; i >= 0; --i)
{
if (a[i] != *it)
break;
if (i > 0 && a[i] == 1 && a[i - 1] == 1)
;
else
++it;
++res;
}
}
cout << res << "\n";
return 0;
}
CELICA