201222: [AtCoder]ARC122 C - Calculator

Memory Limit:1024 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $600$ points

Problem Statement

Snuke has integers $x$ and $y$. Initially, $x=0,y=0$.

Snuke can do the following four operations any number of times in any order:

  • Operation $1$: Replace the value of $x$ with $x+1$.

  • Operation $2$: Replace the value of $y$ with $y+1$.

  • Operation $3$: Replace the value of $x$ with $x+y$.

  • Operation $4$: Replace the value of $y$ with $x+y$.

You are given a positive integer $N$. Do at most $130$ operations so that $x$ will have the value $N$. Here, $y$ can have any value. We can prove that such a sequence of operations exists under the constraints of this problem.

Constraints

  • $1 \leq N \leq 10^{18}$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$

Output

Print your answer in the following format:

$K$
$t_1$
$t_2$
$\vdots$
$t_K$

Here, $K$ $(0 \leq K \leq 130)$ denotes the number of operations, and $t_i$$(1 \leq t_i \leq 4)$ represents the $i$-th operation to be done.


Sample Input 1

4

Sample Output 1

5
1
4
2
3
1

Here, the values of $x$ and $y$ change as follows: $(0,0)\rightarrow$ (Operation $1$) $\rightarrow (1,0) \rightarrow$ (Operation $4$) $\rightarrow (1,1) \rightarrow$ (Operation $2$) $\rightarrow (1,2) \rightarrow$ (Operation $3$) $\rightarrow (3,2) \rightarrow$ (Operation $1$) $\rightarrow (4,2)$, and the final value of $x$ matches $N$.

Input

题意翻译

### 题目描述 Snuke有整数$x$和$y$。最初,$x=0,y=0$。 Snuke可以以任何顺序执行以下四种操作任意次: - 操作$1$:将$x+1$。 - 操作$2$:将$y+1$。 - 操作$3$:将$x+y$。 - 操作$4$:将$y+x$。 给你一个正整数$N$。最多做$130$次运算,使$x$的值为$N$。在这里,$y$可以有任何值。 我们可以证明,在这个问题的约束下,存在这样一个运算序列。 ### 输入格式 一个正整数$N$。 ### 输出格式 第一行一个正整数$K$,表示变化的次数。 下面$K$行,每行一个正整数,表示第几种操作。

加入题单

算法标签: