CF1584A.Mathematical Addition
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Ivan decided to prepare for the test on solving integer equations. He noticed that all tasks in the test have the following form:
- You are given two positive integers u and v, find any pair of integers (not necessarily positive) x, y, such that:
ux+vy=u+vx+y.
- The solution x=0, y=0 is forbidden, so you should find any solution with (x,y)=(0,0).
Please help Ivan to solve some equations of this form.
输入格式
The first line contains a single integer t ( 1≤t≤103 ) — the number of test cases. The next lines contain descriptions of test cases.
The only line of each test case contains two integers u and v ( 1≤u,v≤109 ) — the parameters of the equation.
输出格式
For each test case print two integers x , y — a possible solution to the equation. It should be satisfied that −1018≤x,y≤1018 and (x,y)=(0,0) .
We can show that an answer always exists. If there are multiple possible solutions you can print any.
输入输出样例
输入#1
4 1 1 2 3 3 5 6 9
输出#1
-1 1 -4 9 -18 50 -4 9
说明/提示
In the first test case: 1−1+11=0=1+1−1+1 .
In the second test case: 2−4+39=1=2+3−4+9 .
In the third test case: 3−18+550=4=3+5−18+50 .
In the fourth test case: 6−4+99=31=6+9−4+9 .