-
11727번백준알고리즘/DP알고리즘 2020. 10. 3. 14:51
#include<iostream> using namespace std; int main() { int dp[1001]; int n; cin >> n; dp[0] = 0; dp[1] = 1; dp[2] = 3; dp[3] = 5; for (int i = 4; i <= n; i++) { dp[i] = (dp[i - 1] + dp[i - 2]*2) % 10007; } cout << dp[n]; }