結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー alorie10alorie10
提出日時 2020-03-16 18:38:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 222 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 63,076 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-08-18 19:24:06
合計ジャッジ時間 4,191 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
ll n,m;
ll fib(ll n){
    if(n==1)return 0;
    if(n==2)return 1;
    return (fib(n-1)+fib(n-2))%m;
}
int main(void){
    cin>>n>>m;
    cout<<fib(n)<<endl;
}
0