結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー |
|
提出日時 | 2019-07-31 01:27:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 118 ms / 2,000 ms |
コード長 | 263 bytes |
コンパイル時間 | 1,990 ms |
コンパイル使用メモリ | 191,952 KB |
最終ジャッジ日時 | 2025-01-07 10:14:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n, m; cin>>n>>m; ll a=0; ll b=1; for (int i=3; i<=n; i++) { ll t = b; b = (a+b)%m; a = t; } cout << b << endl; return 0; }