結果
| 問題 |
No.718 行列のできるフィボナッチ数列道場 (1)
|
| コンテスト | |
| ユーザー |
takayuki
|
| 提出日時 | 2018-07-27 22:53:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 464 bytes |
| コンパイル時間 | 580 ms |
| コンパイル使用メモリ | 80,888 KB |
| 実行使用メモリ | 16,952 KB |
| 最終ジャッジ日時 | 2024-07-05 03:16:58 |
| 合計ジャッジ時間 | 7,007 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 19 |
ソースコード
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
int main(void){
long long int F0=0;
long long int F1=1;
long long int F2=0;
int N;
long long int ans=1;
cin>>N;
for(int i=2; i<=N; i++){
F2=F0+F1;
F2%=1000000007;
ans+=(F2*F2);
ans%=1000000007;
F0=F1;
F1=F2;
}
std::cout<<ans<<std::endl;
}
takayuki