## ECOO '17 R2 P4 - Zig Zag

View as PDF

Points: 12 (partial)
Time limit: 13.0s
Memory limit: 256M

Author:
Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

A sequence of integers from to is said to be zig zag if the sequence contains each integer exactly once and, indexing from one, every element at an even index is greater than the preceding one, and every element at an odd index is less than the preceding one.

For example:

Sequence
is zig zag
is zig zag
is NOT zig zag (the fourth element is less than the third element)

#### Input Specification

The input will contain test cases. Each test case has one line with the integer .

For the first four test cases in the file, . For the first seven cases, .

#### Output Specification

For each test case, output the number of unique zig zag sequences possible for that value of , modulo or .

"Modulo " means that if the answer is you should output because that's the remainder of divided by .

#### Sample Input

3
4
5

#### Sample Output

2
5
16

Note: Only cases are shown in this sample.

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org