結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー aaa
提出日時 2017-06-23 16:44:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 311 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 54,920 KB
実行使用メモリ 13,636 KB
最終ジャッジ日時 2024-10-03 04:11:03
合計ジャッジ時間 4,654 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include <iostream>
using namespace std;

int fa(int,int);

int main(){
	//while (1){

	int n,m;
	cin>>n>>m;
	//cout<<n<<endl<<m<<endl;

	int ans=fa(n,m);
	printf("%d\n",ans);
	
	//}

	return 0;
}

int fa(int n,int m){
	if(n==1) return 0;
	if(n==2) return 1;
	return (fa(n-1,m)+fa(n-2,m))%m;
}
0