CF1699A.The Third Three Number Problem
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a positive integer n . Your task is to find any three integers a , b and c ( 0≤a,b,c≤109 ) for which (a⊕b)+(b⊕c)+(a⊕c)=n , or determine that there are no such integers.
Here a⊕b denotes the bitwise XOR of a and b . For example, 2⊕4=6 and 3⊕1=2 .
输入格式
Each test contains multiple test cases. The first line contains a single integer t ( 1≤t≤104 ) — the number of test cases. The following lines contain the descriptions of the test cases.
The only line of each test case contains a single integer n ( 1≤n≤109 ).
输出格式
For each test case, print any three integers a , b and c ( 0≤a,b,c≤109 ) for which (a⊕b)+(b⊕c)+(a⊕c)=n . If no such integers exist, print −1 .
输入输出样例
输入#1
5 4 1 12 2046 194723326
输出#1
3 3 1 -1 2 4 6 69 420 666 12345678 87654321 100000000
说明/提示
In the first test case, a=3 , b=3 , c=1 , so (3⊕3)+(3⊕1)+(3⊕1)=0+2+2=4 .
In the second test case, there are no solutions.
In the third test case, (2⊕4)+(4⊕6)+(2⊕6)=6+2+4=12 .