結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
RIGIH
|
| 提出日時 | 2017-06-23 16:46:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 311 bytes |
| コンパイル時間 | 521 ms |
| コンパイル使用メモリ | 55,432 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2024-10-03 04:11:31 |
| 合計ジャッジ時間 | 4,929 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 TLE * 1 -- * 8 |
ソースコード
#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;
}
RIGIH