当前位置:网站首页>Cf:a. the third three number problem
Cf:a. the third three number problem
2022-07-05 13:01:00 【White speed Dragon King's review】

analysis
In the course of the game, I created the XOR distribution law , Directly put yourself speechless
First of all, we should make good use of the nature of XOR
a ^ 0 = a
a ^ a = 0
if a ^ b = c be c ^ b = a
^ There is a law of association, not a law of distribution
therefore , about a Even numbers , obviously a // 2, 0, 0 It's a set of solutions , I'm dizzy
About a It is the proof that odd numbers are not tenable
About a + b and a ^ b Proof of parity
if a + b It's me , explain a and b With the odd and even , The last one is the same , therefore a ^ b And then finally 0, therefore a ^ b Even
if a + b It's strange , explain a and b The last one is different , therefore a ^ b And then finally 1, therefore a ^ b Is odd
With the help of the above lemma , It is known that (a ^ b) + (b ^ c) + (c ^ a) = n
And then there is (a ^ b) ^ (b ^ c) = a ^ c
So the initial formula can be reduced to x + y + (x ^ y) = n
obviously n It's even
speechless
ac code
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = int(input())
if n % 2 == 1:
print(-1)
else:
print(n // 2, 0, 0)
summary
Bit operation fails
Math doesn't work
边栏推荐
- SAP SEGW 事物码里的 ABAP 类型和 EDM 类型映射的一个具体例子
- ABAP editor in SAP segw transaction code
- uni-app开发语音识别app,讲究的就是简单快速。
- Run, open circuit
- SAP UI5 DynamicPage 控件介紹
- Research: data security tools cannot resist blackmail software in 60% of cases
- HiEngine:可媲美本地的云原生内存数据库引擎
- SAP ui5 objectpagelayout control usage sharing
- A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
- 155. Minimum stack
猜你喜欢

简单上手的页面请求和解析案例

无密码身份验证如何保障用户隐私安全?
![[cloud native] event publishing and subscription in Nacos -- observer mode](/img/0f/34ab42b7fb0085f58f36eb67b6f107.png)
[cloud native] event publishing and subscription in Nacos -- observer mode

RHCAS6

函数传递参数小案例

超高效!Swagger-Yapi的秘密
![[Nacos cloud native] the first step of reading the source code is to start Nacos locally](/img/f8/d9b848593cf7380a6c99ee0a8158f8.png)
[Nacos cloud native] the first step of reading the source code is to start Nacos locally

Comprehensive upgrade of Taobao short video photosynthetic platform

Taobao order interface | order flag remarks, may be the most stable and easy-to-use interface

Introduction to sap ui5 dynamicpage control
随机推荐
Simply take stock reading notes (3/8)
Talk about my drawing skills in my writing career
Transactions from January 14 to 19, 2022
RHCSA7
OpenHarmony应用开发之Navigation组件详解
Taobao short video, why the worse the effect
JXL notes
以VMware创新之道,重塑多云产品力
SAP SEGW 事物码里的 Association 建模方式
2021.12.16-2021.12.20 empty four hand transaction records
Taobao order amount check error, avoid capital loss API
Halcon template matching actual code (I)
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution
insmod 提示 Invalid module format
Alibaba cloud SLB load balancing product basic concept and purchase process
Pandora IOT development board learning (HAL Library) - Experiment 7 window watchdog experiment (learning notes)
2021-12-21 transaction record
Laravel document reading notes -mews/captcha use (verification code function)
CVPR 2022 | single step 3D target recognizer based on sparse transformer