結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
![]() |
提出日時 | 2018-10-09 19:25:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 294 bytes |
コンパイル時間 | 1,484 ms |
コンパイル使用メモリ | 166,852 KB |
実行使用メモリ | 22,912 KB |
最終ジャッジ日時 | 2024-10-12 16:38:53 |
合計ジャッジ時間 | 2,394 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n >> m; vector<int> f(5000001); f[0] = 0,f[1] = 1; for(int i = 2; i < n; i++){ f[i] = f[i-1] + f[i-2]; f[i] %= m; } cout << f[n-1] << endl; return 0; }