東京海上日動 プログラミングコンテスト2021 (AtCoder Regular Contest 122)
翻译中…
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.
翻译中…
样例
Input #1
4
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$.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。