import java.util.Scanner;

public class Main{

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int testCount = sc.nextInt();
		int dp [] = new int[12];
		int result[] = new int[testCount];
		for(int i=0;i<testCount;i++) {
			int testNum = sc.nextInt();
			dp[0]=0;
			for(int j=1;j<=testNum;j++) {
				if(dp[j]>0) {
					//중복 제거
					continue;
				}
				else if(j==1) dp[j] = 1;
				else if(j==2) dp[j] = 2;
				else if(j==3) dp[j] = 4;
				else dp[j] = dp[j-3] + dp[j-2] + dp[j-1];
			}
			result[i] = dp[testNum];
		}
		for(int i=0;i<result.length;i++) {
			System.out.println(result[i]);
		}
	}
}

'algorism' 카테고리의 다른 글

11727 2xn 타일링 2  (0) 2019.02.11
11726 2xn 타일링  (0) 2019.02.11
1463 1로 만들기  (0) 2019.02.11
11053 가장 긴 증가하는 부분 수열 java  (0) 2019.02.10
10844 쉬운 계단 수 java  (0) 2019.02.10

+ Recent posts