알고리즘

C++ 알고리즘 - 백준 11727 2*n 타일링 2

마루설아 2025. 1. 6. 21:36

https://www.acmicpc.net/problem/11727

 

#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

int main(void) {
	/************** C++ Init **************/
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	/************** C++ Init **************/


	int input1;
	int a = 1;
	vector<int> v;
	v.push_back(1);
	v.push_back(1);
	v.push_back(3);
	v.push_back(5);

	cin >> input1;

	for (int i = 4; i <= 1000; i++) {
		v.push_back((v[i-2] * 2 + v[i - 1]) % 10007);
	}

	cout << v[input1] % 10007;
}