[Programmers] 타일 장식물

Time Lapse :5min 0sec

solution.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <string>
#include <vector>

using namespace std;

long long solution(int N) {
vector<long long> answer(N+1,0);
answer[0]=1;
answer[1]=1;
for(int i=2;i<=N;i++){
answer[i]=answer[i-1]+answer[i-2];
}
return answer[N]*2+answer[N-1]*2;
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/30/PS/Programmers/tileDecorations/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.