結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
👑 |
提出日時 | 2019-03-21 23:41:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 372 bytes |
コンパイル時間 | 575 ms |
コンパイル使用メモリ | 72,276 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 02:06:32 |
合計ジャッジ時間 | 1,705 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <iostream> #include <cstdlib> #include <vector> #include <algorithm> #include <cmath> #include <iostream> #include <iomanip> #include <deque> int main() { int n, m; std::cin >> n >> m; long a = 0, b = 1; for(int i = 2; i < n; i++){ int t = a; a = b; b = (t + b) % m; } std::cout << b << std::endl; return 0; }