cgy12306

[백준 BoJ] 11727 - 2xn 타일링 2 본문

Algorithm/C++

[백준 BoJ] 11727 - 2xn 타일링 2

cgy12306 2021. 3. 25. 16:42
// https://www.acmicpc.net/problem/11727
// 2xn 타일링 2

#include<iostream>
using namespace std;
int dp[1001];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;
    dp[1] = 1;
    dp[2] = 3;
    for (int i = 3; i <= n; i++) {
        dp[i] = (dp[i - 1] + (2 * dp[i - 2])) % 10007;
    }
    cout << dp[n];
}

'Algorithm > C++' 카테고리의 다른 글

[백준 BoJ] 2875 - 대회 or 인턴  (0) 2021.03.25
[백준 BoJ] 2747 - 피보나치 수  (0) 2021.03.25
[백준 BoJ] 11726 - 2xn 타일링  (0) 2021.03.25
[백준 BoJ] 1463 - 1로 만들기  (0) 2021.03.25
[백준 BoJ] 1260 - DFS와 BFS  (0) 2021.03.25
Comments