結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー spb9876spb9876
提出日時 2017-10-19 15:52:07
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 396 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 57,812 KB
実行使用メモリ 10,272 KB
最終ジャッジ日時 2024-05-01 05:58:10
合計ジャッジ時間 4,983 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,012 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 14 ms
6,940 KB
testcase_05 AC 940 ms
6,944 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;
int fiv(int x);
int n,m;
int main(void){
  int result;
  cin >> n >> m;
  result = fiv(n);
  cout << result << "\n";
  return 0;
}

int fiv(int x){
  switch (x) {
    case 1:
      return 0;
      break;
    case 2:
      return 1;
      break;
    default:
      return (fiv(x-1)+fiv(x-2))%m;
  }
}
0