| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 64 | 21 | 15 | 33.333% |
You've just bought a new lamp that can emit light of any color! However, its controls are a bit tricky.
We will represent colors as triples $(r, g, b)$ of real numbers between 0ドル$ and 255ドル,ドル inclusive. The lamp controller has eight buttons, one for each of the basic colors: black $(0, 0, 0),ドル red $(255, 0, 0),ドル green $(0, 255, 0),ドル blue $(0, 0, 255),ドル cyan $(0, 255, 255),ドル magenta $(255, 0, 255),ドル yellow $(255, 255, 0),ドル and white $(255, 255, 255)$.
When you push the button of color $c,ドル the color of the lamp is linearly changing towards $c,ドル at the speed of 1ドル$ unit of distance per second. Once the color of the lamp reaches $c,ドル it stops changing. However, you can also stop pushing the button at any earlier moment, leaving the lamp color in some intermediate state. It is not allowed to push two or more buttons at the same time.
Formally, each button push is described by a basic color $(r_c, g_c, b_c),ドル where each of $r_c,ドル $g_c,ドル and $b_c$ is equal to either 0ドル$ or 255ドル,ドル and a non-negative real number $d$. Let $p$ and $c = (r_c, g_c, b_c)$ be the 3D points corresponding to the current lamp color and to the button color, and let $\overrightarrow{v} = c - p$ be the vector between them. If $p = c,ドル pushing this button does nothing. Otherwise, if you push the button for $d$ seconds, the lamp color will change to $p + \frac{\overrightarrow{v}}{|\overrightarrow{v}|} \cdot \min(d, |\overrightarrow{v}|)$.
You are given a target color $(r, g, b),ドル where $r,ドル $g,ドル and $b$ are integers. Initially, the lamp is black. Find any sequence of at most 10ドル$ button pushes that changes its color to $(r, g, b)$. It is guaranteed that such a sequence always exists.
Each test contains multiple test cases. The first line contains the number of test cases $t$ (1ドル \le t \le 10^4$). The description of the test cases follows.
The only line of each test case contains three integers $r,ドル $g,ドル and $b,ドル denoting the target color (0ドル \le r, g, b \le 255$).
For each test case, print an integer $m,ドル denoting the number of button pushes in your sequence (0ドル \le m \le 10$).
Then, print $m$ lines, describing button pushes in your sequence in chronological order. Each of these lines must contain three integers $r_c,ドル $g_c,ドル and $b_c,ドル followed by a real number $d$ ($r_c, g_c, b_c \in \{0, 255\}$; 0ドル \le d \le 10^4$).
Your answer will be considered correct if the distance between point $(r, g, b)$ and the point corresponding to the lamp color after your sequence does not exceed 10ドル^{-6}$.
You do not have to find the shortest sequence. If there are multiple solutions, print any of them.
3 105 255 175 174 174 174 0 0 0
3 0 255 0 3000.0 0 255 255 119.0 255 255 255 119.0 1 255 255 255 301.376840517 2 255 255 255 50.216 0 0 0 58.0