No.1243 Divisor Addition
Problem Statement
You are given integers $A,B$. You may perform the following operation on the integer $A$ up to $120$ times.
- Choose one positive divisor of $A$ and add it to $A$.
It can be shown that under the constraints of this problem, a sequence of operations satisfying the condition always exists.
You are given $T$ test cases.
Input
$T$ $A_1\ B_1$ $A_2\ B_2$ $\vdots$ $A_T\ B_T$
Line $1$ contains the number of test cases $T$.
Each of the following $T$ lines contains integers $A_i,B_i$ separated by a space.
- All inputs are integers.
- $1 \le T \le 100$
- $1 \le A_i < B_i \le 10^{18}$
Output
Print $2T$ lines.
On line $2i - 1$, print the number of operations $K(1 \le K \le 120)$ for the $i$-th test case.
On line $2i$, print the integers $X_1 \ X_2 \dots X_K$ chosen in the operations for the $i$-th test case, separated by spaces.
$X_j$ is the integer added to $A_i$ in the $j$-th operation, and it must be a positive divisor of $A_i$ after the $j-1$-th operation.
Print a newline at the end.
Sample
Sample 1
Input
2 26 57 100000000000 200000000000
Output
4 1 9 2 19 1 100000000000
In test case $1$, $A$ changes as $26 \to 27 \to 36 \to 38 \to 57$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
tute7627
ngtkana