結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
zaichu
|
| 提出日時 | 2017-06-18 20:11:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 859 ms |
| コンパイル使用メモリ | 82,004 KB |
| 実行使用メモリ | 22,784 KB |
| 最終ジャッジ日時 | 2024-10-01 20:29:29 |
| 合計ジャッジ時間 | 1,669 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 2 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int n,m;
cin >> n >> m;
vector<int> fib(n+1);
fib[1] = 0; fib[2] = 1;
for(int i = 3; i < n + 1; i++){
fib[i] = (fib[i-1] + fib[i-2]) % m;
}
cout << fib[n] << endl;
}
zaichu