当前位置:网站首页>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
边栏推荐
- [Nacos cloud native] the first step of reading the source code is to start Nacos locally
- 国内市场上的BI软件,到底有啥区别
- From the perspective of technology and risk control, it is analyzed that wechat Alipay restricts the remote collection of personal collection code
- stirring! 2022 open atom global open source summit registration is hot!
- mysql拆分字符串做条件查询
- I'm doing open source in Didi
- 谈谈我写作生涯的画图技巧
- 解决uni-app配置页面、tabBar无效问题
- Developers, is cloud native database the future?
- 2021-12-21 transaction record
猜你喜欢

潘多拉 IOT 开发板学习(HAL 库)—— 实验7 窗口看门狗实验(学习笔记)

I met Tencent in the morning and took out 38K, which showed me the basic smallpox

Transactions from January 14 to 19, 2022

《2022年中國銀行業RPA供應商實力矩陣分析》研究報告正式啟動

Shi Zhenzhen's 2021 summary and 2022 outlook | colorful eggs at the end of the article

Transactions on December 23, 2021

HiEngine:可媲美本地的云原生内存数据库引擎

Simply take stock reading notes (3/8)

Laravel文档阅读笔记-mews/captcha的使用(验证码功能)

Get to know linkerd project for the first time
随机推荐
MySQL giant pit: update updates should be judged with caution by affecting the number of rows!!!
Concurrent performance test of SAP Spartacus with JMeter
Hiengine: comparable to the local cloud native memory database engine
HiEngine:可媲美本地的云原生内存数据库引擎
Insmod prompt invalid module format
关于 SAP UI5 floating footer 显示与否的单步调试以及使用 SAP UI5 的收益
非技术部门,如何参与 DevOps?
10 minute fitness method reading notes (3/5)
Introduction to sap ui5 dynamicpage control
A deep long article on the simplification and acceleration of join operation
NFT: how to make money with unique assets?
自然语言处理从小白到精通(四):用机器学习做中文邮件内容分类
Research: data security tools cannot resist blackmail software in 60% of cases
简单上手的页面请求和解析案例
函数传递参数小案例
RHCSA3
SAP SEGW 事物码里的导航属性(Navigation Property) 和 EntitySet 使用方法
无密码身份验证如何保障用户隐私安全?
I met Tencent in the morning and took out 38K, which showed me the basic smallpox
Alipay transfer system background or API interface to avoid pitfalls