結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー ohreitetsuohreitetsu
提出日時 2018-05-22 22:16:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 263 bytes
コンパイル時間 448 ms
コンパイル使用メモリ 63,816 KB
実行使用メモリ 7,588 KB
最終ジャッジ日時 2023-09-11 01:23:22
合計ジャッジ時間 4,222 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,588 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 26 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 66 ms
4,380 KB
testcase_05 TLE -
testcase_06 -- -
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 M;
int FN(int n){
	if (n==1){
		return 0;
	}else if (n==2){
		return 1;
	}
	return (FN(n-1)%M+FN(n-2)%M)%M;
}
int main(int argc, char* argv[])
{
	int N;
	cin>>N>>M;
	cout<<FN(N)<<endl;
	return 0;
}
0