/ OPS / 题库 /

A Plus and xor

A Plus and xor

#描述#
Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation of operands. In other words, a binary digit of the result is equal to 1 if and only if bits on the respective positions in the operands are different.
For example, if X=109(10)=1101101(2), Y=41(10)=101001(2), then:<br />
X xor Y = 68(10) = 1000100(2).<br />
Write a program, which takes two non-negative integers A and B as an input and finds two non-negative integers X and Y, which satisfy the following conditions:<br />
&nbsp&nbsp&nbsp&nbsp* A=X+Y<br />
&nbsp&nbsp&nbsp&nbsp* B = X xor Y, where xor is bitwise exclusive or.<br />
&nbsp&nbsp&nbsp&nbsp* X is the smallest number among all numbers for which the first two conditions are true.<br />

#格式#
##输入格式##
For each test case, the first line contains integer number A and the second line contains integer number B (0≤A,B≤2^64-1).

##输出格式##
For each test case, the only output line should contain two integer non-negative numbers X and Y. Print the only number -1 if there is no answer.

#样例1#
##样例输入1##

142
76

##样例输出1##

33 109

#限制#
1000ms
32768KB

#提示#

#来源#
daimin

信息

ID
1838
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者