当前位置:网站首页>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
边栏推荐
- 深度长文探讨Join运算的简化和提速
- 超高效!Swagger-Yapi的秘密
- DNS的原理介绍
- 【云原生】Nacos中的事件发布与订阅--观察者模式
- 使用 jMeter 对 SAP Spartacus 进行并发性能测试
- SAP UI5 视图里的 OverflowToolbar 控件
- A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
- How can non-technical departments participate in Devops?
- It's too convenient. You can complete the code release and approval by nailing it!
- 关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
猜你喜欢

非技术部门,如何参与 DevOps?

How can non-technical departments participate in Devops?

2021.12.16-2021.12.20 empty four hand transaction records

石臻臻的2021总结和2022展望 | 文末彩蛋

Hiengine: comparable to the local cloud native memory database engine

About the single step debugging of whether SAP ui5 floating footer is displayed or not and the benefits of using SAP ui5

Kotlin variable

阿里云SLB负载均衡产品基本概念与购买流程

ABAP editor in SAP segw transaction code

解决 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa2 in position 107
随机推荐
自然语言处理从小白到精通(四):用机器学习做中文邮件内容分类
SAP UI5 视图里的 OverflowToolbar 控件
Transactions on December 23, 2021
insmod 提示 Invalid module format
Taobao order amount check error, avoid capital loss API
The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
初识Linkerd项目
Halcon template matching actual code (I)
Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution
A deep long article on the simplification and acceleration of join operation
From the perspective of technology and risk control, it is analyzed that wechat Alipay restricts the remote collection of personal collection code
DNS的原理介绍
RHCSA1
SAP UI5 FlexibleColumnLayout 控件介绍
Introduction to the principle of DNS
Natural language processing series (I) introduction overview
uni-app开发语音识别app,讲究的就是简单快速。
HiEngine:可媲美本地的云原生内存数据库引擎
石臻臻的2021总结和2022展望 | 文末彩蛋
Transactions from December 29, 2021 to January 4, 2022