結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー spb9876
提出日時 2017-10-19 15:52:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 396 bytes
コンパイル時間 397 ms
コンパイル使用メモリ 56,496 KB
実行使用メモリ 120,904 KB
最終ジャッジ日時 2024-11-21 07:36:31
合計ジャッジ時間 29,166 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

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