11726번: 2xn 타일링

myeongrangcoding·2023년 12월 16일
0

백준

목록 보기
28/47

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

풀이

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>

using namespace std;
int Dp[1001];

int main()
{
	ios_base::sync_with_stdio(false);
	cout.tie(nullptr);
	cin.tie(nullptr);
	//freopen("input.txt", "rt", stdin);

	Dp[1] = 1;
	Dp[2] = 2;
	Dp[3] = 3;

	int n{};
	cin >> n;

	for (int i = 4; i <= n; ++i)
	{
		Dp[i] = (Dp[i - 1] + Dp[i - 2]) % 10007;
	}

	cout << Dp[n];

	return 0;
}
profile
명랑코딩!

0개의 댓글