結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
N___hara
|
| 提出日時 | 2020-09-25 14:42:48 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 275 bytes |
| コンパイル時間 | 1,673 ms |
| コンパイル使用メモリ | 194,300 KB |
| 最終ジャッジ日時 | 2025-01-14 20:29:50 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
long long m;
cin >> n >> m;
vector<int> dp(n,0);
dp[1] = 1;
for (int i=2;i<n;i++) {
dp[i] = (dp[i-1]+dp[i-2])%m;
}
cout << dp[n-1] << endl;
}
N___hara