結果
| 問題 | 
                            No.526 フィボナッチ数列の第N項をMで割った余りを求める
                             | 
                    
| コンテスト | |
| ユーザー | 
                             AQUA16573837
                         | 
                    
| 提出日時 | 2018-04-05 01:38:55 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 448 bytes | 
| コンパイル時間 | 632 ms | 
| コンパイル使用メモリ | 65,868 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-26 09:00:22 | 
| 合計ジャッジ時間 | 1,587 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 WA * 2 | 
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         scanf("%d %d", &n, &m);
      |         ~~~~~^~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <iostream>
using namespace std;
using ll = long long;
void solve();
int main() {
	solve();
#ifdef DBG
	while (true);
#endif
}
//526
void solve() {
	int n, m;
	scanf("%d %d", &n, &m);
	deque<int> fin({0, 1, 0});
	for (int i = 2; i <= n; i++) {
		fin.pop_front();
		fin.push_back((fin.front() + fin.back()) % m);
	}
	printf("%d\n", fin.back());
}
            
            
            
        
            
AQUA16573837