본문 바로가기

카테고리 없음

백준 9095

#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int test;
int arr[11];
vector <int> lst;



int main() {


	cin.tie(0);
	ios_base::sync_with_stdio(false);

	cin >> test;



	for (int i = 0; i < test; i++) {
		int tmp;
		cin >> tmp;

		lst.push_back(tmp);
	}

	for (int i = 0; i < test; i++) {
		int temp = lst[i];
		arr[1] = 1;
		arr[2] = 2;
		arr[3] = 4;

		for (int i = 4; i <= temp; i++) {
		
			arr[i] = arr[i - 1] + arr[i - 2] + arr[i - 3];
		}

		cout << arr[temp] << endl;

	}

	
}