Hide

Problem A
Fibonacci Sequence Chicken Edition

Year $2017$ is the year of chicken, so in this problem we introduce you an interesting programming language: the Chicken Language.

Chicken is an esoteric programming language by Torbjörn Söderstedt, in which “chicken” is the only valid symbol. It is inspired by the paper and the presentation presented at the AAAS humor session by Doug Zongke. We strongly recommend you to watch the presentation after the contest. It’s super fun.

\includegraphics[scale=0.5]{chicken.png}

The paper and the presentation by Doug Zongke.

From https://www.youtube.com/watch?v=yL_-1d9OSdk

As the original chicken language is a bit complicated, we specially designed the Simplified Chicken Language (SCL) for this problem. An SCL program is consisted of only two kinds of tokens: “c” and new line. The number of “c” tokens in the same line corresponds to an opcode. As the program is executed, it will push/pop values to/from a stack (the stack is empty at the beginning). The opcodes and the descriptions for each instruction of SCL are listed below.

Please keep in mind that the stack of the SCL is $1$-based. That is to say, the index of the bottom of the stack is considered to be $1$. In the following table, we indicate the integer at the top of the stack as $x$, and the integer just below the top of the stack as $y$. We also indicate $stack[n]$ as the integer in the stack whose index is $n$.

Opcode

Instruction

Description

1

Add

Pop $x$ and $y$, and push $x+y$ back to the stack. If there are less than two integers in the stack, the program will crash.

2

Subtract

Pop $x$ and $y$, and push $x-y$ back to the stack. If there are less than two integers in the stack, the program will crash.

3

Compare

Pop $x$ and $y$. If $x$ equals to $y$ then push $1$ onto the stack, otherwise push $0$ onto the stack. If there are less than two integers in the stack, the program will crash.

4

Load

Load one integer from the standard input and push it onto the stack. If there is nothing to load, the program will crash.

5

Copy

Pop $x$ and $y$, and copy $stack[y]$ to $stack[x]$. If there are less than two integers in the stack, the program will crash. If $x$ or $y$ is out of the range of the current stack, the program will also crash.

6

Jump

Pop $x$ and $y$. If $y$ is not zero, the program will jump to the $x$-th line and continue to run. If $x$ is larger than the number of lines of the program, the program will stop. If there are less than two integers in the stack, the program will crash. If $x$ is not a positive integer, the program will also crash.

7+

Push

If the Opcode is larger or equal to 7, push the integer $(Opcode-7)$ onto the stack.

When the program stops, it will print out the integer at the top of the stack as the output.

What you need to do is to write an SCL program which can print out the $n$-th element of the Fibonacci sequence. Recall that a Fibonacci sequence is a sequence which satisfies $f(1) = f(2) = 1$ and $f(n) = f(n-1) + f(n-2)$ when $n \ge 3$.

As the online judge system of the contest does not support SCL, you’re supposed to print out your SCL program using other languages like C or C++. A specially designed program will then judge the correctness of your output.

Input

There is no input for your C/C++/etc. program.

For your SCL program, only one integer $n$ ($1 \le n \le 30$) will be given in the standard input, indicating the index of the element in the Fibonacci sequence.

Output

Your C/C++/etc. program should output your SCL program.

Please output your SCL program in the correct format. If your program contains tokens other than “c” or new line (for example, space), or you print extra empty lines at the end of your output, you will get a “wrong answer” verdict.

Also, your SCL program should contain no more than $10^4$ “c” tokens, and your SCL program can execute (NOT contain, but execute!) at most $10^3$ lines of code for each SCL test case, or you will get a “wrong answer” verdict.

Note that if your SCL program crashes due to various reasons, you will still get a “wrong answer” verdict as this problem is special judged.

Your SCL program should print out only one integer $f(n)$, which is the $n$-th element of the Fibonacci sequence.

Please log in to submit a solution to this problem

Log in