結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
|
提出日時 | 2017-06-09 23:02:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 260 bytes |
コンパイル時間 | 524 ms |
コンパイル使用メモリ | 59,036 KB |
実行使用メモリ | 42,512 KB |
最終ジャッジ日時 | 2024-09-22 16:56:52 |
合計ジャッジ時間 | 1,266 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 8 |
ソースコード
#include <iostream> #include <math.h> using namespace std; long f[5000000]; int main(){ int a; int n,m; int sum = 0; f[0] = 0; f[1] = 1; cin >> n >> m; for(int i = 2; i < n;++i){ f[i] = f[i - 2]+f[i - 1]; } cout << f[n-1] % m <<endl; }