P7578 "RdOI R2" Number (number)
Description
Find three distinct positive integers $x,y,z(x\gt y\gt z)$ such that, for any two of them, their sum is divisible by the third number.
Now you are given several types of requirements as follows:
- Given the value of $x-y$, find $x,y,z$.
- Given the value of $x-z$, find $x,y,z$.
- Given the value of $y-z$, find $x,y,z$.
Input Format
There are $T+1$ lines in total.
The first line contains an integer $T$, indicating that there are $T$ test cases.
The next $T$ lines each contain two items:
1. A string, which can be $x-y$, $x-z$, or $y-z$, indicating which two numbers were subtracted to obtain the given value.
2. A number, the value of this difference.
Output Format
There are $T$ lines in total.
Each line outputs three positive integers $x,y,z$ (as described above). The problem guarantees that a solution exists.
Explanation/Hint
**Sample Explanation**
From $x-y=1$, we know that the difference between $x$ and $y$ is $1$. After trying, we get $x=3,y=2,z=1$.
It is then clear that $z\mid (x+y)$, $y\mid (x+z)$, and $x\mid (y+z)$.
---
**Constraints**
- For $1\%$ of the testdata, i.e., Sample \#1.
- For $100\%$ of the testdata, $1\le T\le 10^6,1\le x,y,z\le10^8$.
Translated by ChatGPT 5