結果
問題 |
No.954 Result
|
ユーザー |
![]() |
提出日時 | 2019-12-17 01:32:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 926 bytes |
コンパイル時間 | 1,846 ms |
コンパイル使用メモリ | 176,648 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 21:04:12 |
合計ジャッジ時間 | 9,234 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 7 |
other | RE * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long INF=1000000000+5; map<long long,bool> flag; vector<long long> memo(1000000000,0); long long fib(long long n){ if(n<=1){ flag[1]=true; return 1; } if(memo[n]!=0){ return memo[n]; } memo[n]=fib(n-1)+fib(n-2); flag[memo[n]]=true; return memo[n]; } int main(){ vector<long long> a(5); for(int i=0;i<5;i++){ cin >> a[i]; } int i=1; while(fib(i)<=INF){ i*=2; } if(flag[a[4]]==true && flag[a[3]]==true && flag[abs(a[3]-a[4])]==true && a[4]<a[3]){ for(int i=2;i>=0;i--){ if(a[i]!=a[i+1]+a[i+2]){ cout << 5-i-1 << endl; return 0; } } cout << 5 << endl; return 0; } if(flag[a[4]]==true){ cout << 1 << endl; return 0; } cout << 0 << endl; return 0; }