結果
問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
ユーザー |
|
提出日時 | 2017-06-19 11:41:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 242 bytes |
コンパイル時間 | 544 ms |
コンパイル使用メモリ | 54,492 KB |
実行使用メモリ | 23,040 KB |
最終ジャッジ日時 | 2024-10-02 07:37:37 |
合計ジャッジ時間 | 1,288 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 2 |
ソースコード
#include<iostream> using namespace std; int main() { int n,m; cin >> n >> m; int array[n]; array[0] = 0; array[1] = 1; for(int i=2;i<n;i++){ array[i] = (array[i-2]+array[i-1])%m; } cout << array[n-1] << endl; return 0; }