백준 문제풀이

백준 2193번 - C++

diligent_gideok 2022. 5. 13. 17:03
#include <bits/stdc++.h>
using namespace std;

long long D[100][2];
int n;
int main(void) {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	D[1][1] = 1LL;
	for (int i = 2; i <= n; i++) {
		D[i][0] = D[i - 1][0] + D[i-1][1];
		D[i][1] = D[i - 1][0];
	}
	cout << D[n][0]+D[n][1];


}

'백준 문제풀이' 카테고리의 다른 글

백준 11055번 - C++  (0) 2022.05.13
백준 1912번 - C++  (0) 2022.05.13
백준 11727번 - C++  (0) 2022.05.13
백준 1932번 - C++  (0) 2022.05.13
백준 1003번 - C++  (0) 2022.05.13