結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー alorie10alorie10
提出日時 2021-06-18 02:07:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 397 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 165,748 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 13:40:40
合計ジャッジ時間 6,311 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
ll n,h,w,m,a,b,ok,ok2,cnt,tmp,ans,dp[30][30],dp2[30][30],M;
string s[30];
vector<ll> v;
ll fib(ll a,ll b){
    if(a==1)return 0;
    if(a==2)return 1;
    return (fib(a-1,b)+fib(a-2,b))%b;
}
int main(void){
    cin>>n>>m;
    cout<<fib(n,m)<<endl;
}
0