結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー RIGIHRIGIH
提出日時 2017-06-23 16:46:52
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 311 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 55,756 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-04-14 06:58:05
合計ジャッジ時間 5,133 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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