当前位置:网站首页>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
边栏推荐
- How can non-technical departments participate in Devops?
- 石臻臻的2021总结和2022展望 | 文末彩蛋
- 阿里云SLB负载均衡产品基本概念与购买流程
- SAP self-development records user login logs and other information
- Free testing of Taobao tmall API order and flag insertion remark interface
- 【Nacos云原生】阅读源码第一步,本地启动Nacos
- uni-app开发语音识别app,讲究的就是简单快速。
- mysql拆分字符串做条件查询
- 自然语言处理从小白到精通(四):用机器学习做中文邮件内容分类
- DNS的原理介绍
猜你喜欢

Developers, is cloud native database the future?

初识Linkerd项目

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

RHCSA7

Discussion on error messages and API versions of SAP ui5 getsaplogonlanguage is not a function

国内市场上的BI软件,到底有啥区别

A deep long article on the simplification and acceleration of join operation

解决 UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa2 in position 107

Association modeling method in SAP segw transaction code

逆波兰表达式
随机推荐
Comprehensive upgrade of Taobao short video photosynthetic platform
ABAP editor in SAP segw transaction code
RHCAS6
Taobao product details API | get baby SKU, main map, evaluation and other API interfaces
单独编译内核模块
How to connect the API interface of Taobao open platform (super detailed)
SAP SEGW 事物码里的 Association 建模方式
Install rhel8.2 virtual machine
[cloud native] use of Nacos taskmanager task management
Simply take stock reading notes (1/8)
Discussion on error messages and API versions of SAP ui5 getsaplogonlanguage is not a function
逆波兰表达式
Compile kernel modules separately
初次使用腾讯云,解决只能使用webshell连接,不能使用ssh连接。
SAP SEGW 事物码里的导航属性(Navigation Property) 和 EntitySet 使用方法
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
Natural language processing from Xiaobai to proficient (4): using machine learning to classify Chinese email content
跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
RHCSA2
Lepton 无损压缩原理及性能分析