Programming contests

DEIK Regionális Programozó Csapatverseny, középiskolai kategória, 2013. december 1.

December 1, 2013 10:30 AM – December 1, 2013 3:30 PM

Delivery Debacle

Wolfgang Puck has two very peculiar habits:

  1. He only makes two shapes of cakes. One is square and has an area of one unit. The other is L-shaped and has an area of three units.
  2. He will only deliver cakes packed in boxes of very specific sizes. The boxes are always 2 units wide and are of varying length.

One day, Wolfgang wondered in how many different ways he can pack his cakes into certain sized boxes. Can you help him?


The precise sizes of the cakes Wolfgang makes, and one way to pack them in a box of length 6.


The five ways to pack a box of length 2.

Input Specification

The input begins with t, the number of different box lengths. Each of the following t lines contains an integer n (1 ≤ n ≤ 40).

Output Specification

For each n, output on a separate line the number of different ways to pack a 2-by-n box with cakes described above. Output is guaranteed to be less than 1018.

Sample Input

  1. 2
  2. 1
  3. 2
download as text file

Output for Sample Input

  1. 1
  2. 5
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019