結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2017-06-12 09:35:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 314 bytes |
コンパイル時間 | 392 ms |
コンパイル使用メモリ | 54,544 KB |
実行使用メモリ | 23,040 KB |
最終ジャッジ日時 | 2024-09-24 16:42:21 |
合計ジャッジ時間 | 1,068 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 9 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 9 | main(){ | ^~~~
ソースコード
#include <iostream> using namespace std; int fibo(int); int f1,f2; main(){ int N,M,F; cin >> N >> M; F=fibo(N); F=F%M; cout << F << endl; return 0; } int fibo(int N){ int a; if(N==2){ f1=0; return 1; }else{ f2=fibo(N-1); a=f2+f1; f1=f2; return a; } }