結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2019-07-28 19:27:19 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 282 bytes |
| コンパイル時間 | 1,519 ms |
| コンパイル使用メモリ | 165,192 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 15:06:09 |
| 合計ジャッジ時間 | 2,520 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 1 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
long n, m;
cin >> n >> m;
long prev = 0, current = 1;
for (long i = 2; i <= n; i++) {
long w = (current + prev) % m;
prev = current;
current = w;
}
cout << current << endl;
}
trineutron