結果

問題 No.718 行列のできるフィボナッチ数列道場 (1)
ユーザー takayukitakayuki
提出日時 2018-07-27 22:53:40
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 464 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 75,140 KB
実行使用メモリ 11,964 KB
最終ジャッジ日時 2023-09-18 12:25:21
合計ジャッジ時間 6,937 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0