結果

問題 No.534 フィボナッチフィボナッチ数
ユーザー u-shou-sho
提出日時 2017-06-24 00:08:36
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 54,836 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-14 06:40:13
合計ジャッジ時間 6,237 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
13,756 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
long long a=1,b=1,c;
long long fib(int n){
  if(n>2){
  while(n>2){
    c=(a+b)%1000000007;
    a=b%1000000007;
    b=c;
    n--;
  }}else if(n==2){c=1;}
  else if(n==1){c=1;}

  return c;
}

int main(){
  long long n;
  cin>>n;

  n=fib(n);
  n=fib(n);
  cout<<n<<endl;
  return 0;
}
0