309561: CF1699A. The Third Three Number Problem

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

The Third Three Number Problem

题意翻译

你需要构造出三元组 $a,b,c$ 使得 $(a \oplus b)+(a \oplus c) + (b \oplus c) = n$。其中 $0 \leq a,b,c \leq 10^9$。 符号 $\oplus$ 的意思为异或。

题目描述

You are given a positive integer $ n $ . Your task is to find any three integers $ a $ , $ b $ and $ c $ ( $ 0 \le a, b, c \le 10^9 $ ) for which $ (a\oplus b)+(b\oplus c)+(a\oplus c)=n $ , or determine that there are no such integers. Here $ a \oplus b $ denotes the [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of $ a $ and $ b $ . For example, $ 2 \oplus 4 = 6 $ and $ 3 \oplus 1=2 $ .

输入输出格式

输入格式


Each test contains multiple test cases. The first line contains a single integer $ t $ ( $ 1 \le t \le 10^4 $ ) — 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 \le n \le 10^9 $ ).

输出格式


For each test case, print any three integers $ a $ , $ b $ and $ c $ ( $ 0 \le a, b, c \le 10^9 $ ) for which $ (a\oplus b)+(b\oplus c)+(a\oplus 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 \oplus 3)+(3 \oplus 1) + (3 \oplus 1)=0+2+2=4 $ . In the second test case, there are no solutions. In the third test case, $ (2 \oplus 4)+(4 \oplus 6) + (2 \oplus 6)=6+2+4=12 $ .

Input

题意翻译

你需要构造出三元组 $a,b,c$ 使得 $(a \oplus b)+(a \oplus c) + (b \oplus c) = n$。其中 $0 \leq a,b,c \leq 10^9$。 符号 $\oplus$ 的意思为异或。

Output

**第三三个数问题**

**题意翻译**
构造三元组 $a, b, c$ 使得 $(a \oplus b) + (a \oplus c) + (b \oplus c) = n$。其中 $0 \leq a, b, c \leq 10^9$。这里的 $\oplus$ 表示异或运算。

**题目描述**
给定一个正整数 $n$,任务是找到三个整数 $a, b, c$($0 \le a, b, c \le 10^9$),使得 $(a \oplus b) + (b \oplus c) + (a \oplus c) = n$,或者确定没有这样的整数存在。这里的 $a \oplus b$ 表示 $a$ 和 $b$ 的[按位异或](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)**第三三个数问题** **题意翻译** 构造三元组 $a, b, c$ 使得 $(a \oplus b) + (a \oplus c) + (b \oplus c) = n$。其中 $0 \leq a, b, c \leq 10^9$。这里的 $\oplus$ 表示异或运算。 **题目描述** 给定一个正整数 $n$,任务是找到三个整数 $a, b, c$($0 \le a, b, c \le 10^9$),使得 $(a \oplus b) + (b \oplus c) + (a \oplus c) = n$,或者确定没有这样的整数存在。这里的 $a \oplus b$ 表示 $a$ 和 $b$ 的[按位异或](https://en.wikipedia.org/wiki/Bitwise_operation#XOR)

加入题单

算法标签: