結果
| 問題 |
No.954 Result
|
| コンテスト | |
| ユーザー |
kyoprouno
|
| 提出日時 | 2019-12-17 02:43:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,338 bytes |
| コンパイル時間 | 1,807 ms |
| コンパイル使用メモリ | 172,760 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 12:35:41 |
| 合計ジャッジ時間 | 2,758 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 7 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long memo[200];
long long fib(int n){
if(n<=1) return 1;
if(memo[n]!=0) return memo[n];
return memo[n]=fib(n-1)+fib(n-2);
}
int main(){
vector<long long> p(150);
for(int i=0;i<150;i++){
p[i]=fib(i);
}
vector<long long> a(5);
for(int i=0;i<5;i++){
cin >> a[i];
}
if(a[4]==1 && a[3]==1){
if(a[2]==2){
if(a[1]==3){
if(a[0]==5){
cout << 5 << endl;
return 0;
}
cout << 4 << endl;
return 0;
}
cout << 3 << endl;
return 0;
}
cout << 2 << endl;
return 0;
}
for(int i=1;i<150;i++){
if(p[i]==a[4]){
if(p[i+1]==a[3]){
for(int j=0;j<3;j++){
if(a[2-j]!=a[3-j]+a[4-j]){
cout << j+2 << endl;
return 0;
}
else if(a[0]==a[1]+a[2] && a[1]==a[2]+a[3] && a[2]==a[3]+a[4]){
cout << 5 << endl;
return 0;
}
}
}
cout << 1 << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
kyoprouno