結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー alorie10
提出日時 2021-06-18 02:07:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 397 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 167,556 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-06-11 20:19:06
合計ジャッジ時間 5,101 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

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