fjnu 1749 Plant's Multiplication

Description

One kind of plant multiplies through its seeds. Planted in the earth in the first year, a seed of this kind of plant grows up into a mature individual in the fourth year. Every mature individual yields one fruit each year, and each fruit contains one seed. Once a fruit yielded, it falls off and is buried in the earth in the same year, and the seed containing in the fruit will grow up into a new mature individual. Now planting one seed of the plant in the earth, please figure out the number of the mature individuals in the Nth year.

Input

The first line of the input is a positive integer K indicating the number of test cases. The following are the K test cases. Each test case includes one line with one positive integer N (N<=60) indicating the serial number of year.

Output

For each test case, output a line including one integer, representing the number of the mature individuals of the plant in the Nth year.

Sample Input

1
10

Sample Output

6

 KEY:这题,只要写他10项左右,就能看出规律了……;

 

Source:

#include
< iostream >
using   namespace  std;

int  a[ 61 ] = {0,0,0,0,1} ;

void  GetList()
{
    
for(int i=5;i<=60;i++)
        a[i]
=a[i-1]+a[i-3];
}


int  main()
{
    GetList();
    
int n,N;
    cin
>>N;
    
for(int i=1;i<=N;i++)
    
{
        cin
>>n;
        cout
<<a[n]<<endl;
    }

    
return 0;
}



你可能感兴趣的:(Integer,input,UP,each,iostream,output)