結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
lunnear
|
| 提出日時 | 2018-11-22 02:48:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 308 bytes |
| コンパイル時間 | 431 ms |
| コンパイル使用メモリ | 53,844 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 16:13:12 |
| 合計ジャッジ時間 | 1,392 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 2 |
ソースコード
#include <iostream>
int main()
{
int n, m;
std::cin >> n >> m;
int f_2 = 0, f_1 = 0;
int f = 1;
for(int i = 2; i < n; i++)
{
f_2 = f_1;
f_1 = f;
f = f_2 + f_1;
f %= m;
}
std::cout << f << std::endl;
return 0;
}
lunnear