結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-30 19:08:34 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 332 bytes |
| コンパイル時間 | 1,935 ms |
| コンパイル使用メモリ | 194,404 KB |
| 最終ジャッジ日時 | 2025-02-20 16:01:11 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
| 外部呼び出し有り |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | system("pause");
| ~~~~~~^~~~~~~~~
ソースコード
// コピーして使う!
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll=vector<long long>;
int main() {
ll n,m;
cin>>n>>m;
vll f(n,0);
f[0]=0;
f[1]=1;
for(ll i=2;i!=f.size();i++){
f[i]=(f[i-1]+f[i-2])%m;
}
cout<<f[f.size()-1]<<endl;
system("pause");
}