링크 : https://www.acmicpc.net/problem/9095
/*
문제 : 1, 2, 3 더하기
링크 : https://www.acmicpc.net/problem/9095
*/
#include <iostream>
using namespace std;
int dp[1000];
void dy(int n){
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
for(int i = 4; i <= n; i++){
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
}
cout << dp[n] << '\n';
return;
}
int main(){
int n ;
cin >> n;
for(int i = 0; i < n; i++){
int tmp;
cin >> tmp;
dy(tmp);
}
return 0;
}