#P9736. [COCI 2022/2023 #2] Ekspert

    ID: 10998 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>2022Special JudgeO2优化COCI(克罗地亚)

[COCI 2022/2023 #2] Ekspert

Problem Description

You are given four variables A\texttt{A}, B\texttt{B}, C\texttt{C}, D\texttt{D} with initial values xx, yy, 00, 11.

You can perform the following operation on them:

Choose two variables, and store their sum into one variable.

Please use this operation no more than 100100 times to make the value of at least one variable equal to x×yx \times y.

Input Format

One line with two integers xx, yy (1x×y10181 \le x \times y \le 10^{18}), with the meaning as described in the statement.

Output Format

The first line outputs a non-negative integer nn (0n1000 \le n \le 100), indicating the number of operations.

In the next nn lines, the ii-th line records the ii-th operation in the form R1 R2 R3\texttt{R1 R2 R3}, meaning to store the sum of R1\texttt{R1} and R2\texttt{R2} into R3\texttt{R3}.

1 2
1
A A A
A
3 2
6
D C C
D C C
D C C
D C C
D C C
D C C
C

Hint

Subtask\text{Subtask} Score Special property
11 1414 x,y50x, y \le 50
22 x×y104x \times y \le 10^4
33 4242 None.

This problem has a full score of 7070 points.

Translated by ChatGPT 5