Pythagorathean Transformation官方中文
题目描述
官方中文For a positive integer $s$, you can perform the following operation an arbitrary number of times (including zero): Choose a positive integer triplet $(a, b, c)$ such that $s \in \{a, b, c\}$, $a^2 + b^2 = c^2$. Choose a positive integer $t \in \{a, b, c\}\setminus \{s\}$,then replace $s$ with $t$. Given $S$ and $T$, you need to transform $S$ into $T$ within 2000 steps ensuring that the value of each number during the transformation does not exceed or determine that it is not possible.官方中文
输入格式
官方中文The only line of input contains two integers $S,T$ $(1\leq S,T\leq 10^9, S\neq T)$.官方中文
输出格式
官方中文If it is not possible to transform $S$ into $T$ within 2000 steps, output “impossible” in a line.
The first line contains one integer $m$ $(1\leq m\leq 2000)$, denoting the number of steps.
Then you need to output $m$ lines, with the $i$-th line containing a positive integer $x$ $(1\leq x\leq 10^{18})$, representing the result after the $i$-th operation.官方中文
样例
3 51
54 122
5
121 100impossible题面与样例版权归 牛客竞赛 及出题人所有;中文翻译由 AI 生成(官方原文),如有出入请以原文为准。