結果
問題 |
No.954 Result
|
ユーザー |
![]() |
提出日時 | 2019-12-17 01:22:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 927 bytes |
コンパイル時間 | 1,890 ms |
コンパイル使用メモリ | 170,300 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-02 20:59:49 |
合計ジャッジ時間 | 4,560 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 WA * 1 RE * 1 |
other | AC * 15 WA * 5 RE * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long INF=10000000+5; vector<bool> flag(10000,false); vector<long long> memo(10000,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)<=10000){ i+=1; } 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; }