Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0245 - EMBROIDERY |
A long band of fabric is about to be embroidered with a geometric pattern. The hori- zontally-oriented band is marked with a 1xn guiding grid. The pattern is made according to the following rules.
-
The pattern starts in the lower left corner.
-
Every stitch connects two corners of a square in the guiding grid. The stitch may go in any direction: vertical, horizontal, or diagonal.
-
The fabric may be punctured only at the corners of grid squares, and only once for each corner. The final pattern must use all the corners.
-
The embroidery is done with a single continuous thread starting in the lower left corner of the grid and ending in any corner of any square.
Your task is to write a program that determines the number of different ways to em- broider a band of size 1xn.
The figure below demonstrates all the 20 ways to embroider a 1x2 band according to the above rules. Front and back stitches are shown with lines of different thickness.
Limitations
1 ≤ n ≤ 30.
Input
The input file contains a single integer n.
Output
The output file should contain a single integer, the number of possible designs.
Example
№ |
stdin |
stdout |
1 |
1 |
6 |
2 |
2 |
20 |
3 |
3 |
72 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-10-08 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | Central QF 2014.K |