結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める | 
| コンテスト | |
| ユーザー |  f1b_maxbl00d | 
| 提出日時 | 2020-08-31 03:00:15 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 124 ms / 2,000 ms | 
| コード長 | 1,629 bytes | 
| コンパイル時間 | 1,405 ms | 
| コンパイル使用メモリ | 122,388 KB | 
| 最終ジャッジ日時 | 2025-01-14 02:15:47 | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 | 
ソースコード
//#pragma warning(disable:4996)
//#include <Windows.h>
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>
//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;
template<class T>
inline void chmin(T& a, T b) {
	a = min(a, b);
}
template<class T>
inline void chmax(T& a, T b) {
	a = max(a, b);
}
void input();
void solve();
void daminput();
int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	input();
	//daminput();
	solve();
	return 0;
}
//////////////////////////////////////////////////
//////////////////////////////////////////////////
int N, M;
void input() {
	cin >> N >> M;
}
void daminput() {
}
void solve() {
	VLL F(N, 0);
	F[1] = 1;
	for (int n = 2; n < N; n++)
	{
		F[n] = (F[n - 1] + F[n - 2]) % M;
	}
	cout << F.back() << "\n";
}
            
            
            
        