当前位置:网站首页>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
边栏推荐
- #yyds干货盘点#js截取文件后缀名
- stirring! 2022 open atom global open source summit registration is hot!
- Introduction to sap ui5 flexiblecolumnlayout control
- Wechat enterprise payment to change access, open quickly
- 《2022年中国银行业RPA供应商实力矩阵分析》研究报告正式启动
- Concurrent performance test of SAP Spartacus with JMeter
- Transactions from January 14 to 19, 2022
- Simply take stock reading notes (3/8)
- Hiengine: comparable to the local cloud native memory database engine
- 你的下一台电脑何必是电脑,探索不一样的远程操作
猜你喜欢
SAP UI5 ObjectPageLayout 控件使用方法分享
Lepton 无损压缩原理及性能分析
Taobao short videos are automatically released in batches without manual RPA open source
stm32和电机开发(从架构图到文档编写)
SAP ui5 objectpagelayout control usage sharing
[cloud native] use of Nacos taskmanager task management
Super efficient! The secret of swagger Yapi
Taobao order interface | order flag remarks, may be the most stable and easy-to-use interface
Hundred days to complete the open source task of the domestic database opengauss -- openguass minimalist version 3.0.0 installation tutorial
Natural language processing series (I) introduction overview
随机推荐
Get to know linkerd project for the first time
Reshape the power of multi cloud products with VMware innovation
The solution of outputting 64 bits from printf format%lld of cross platform (32bit and 64bit)
单独编译内核模块
解决uni-app配置页面、tabBar无效问题
#yyds干货盘点# 解决名企真题:搬圆桌
函数传递参数小案例
Kotlin function
ABAP editor in SAP segw transaction code
SAP ui5 objectpagelayout control usage sharing
2021.12.16-2021.12.20 empty four hand transaction records
Simply take stock reading notes (4/8)
MySQL splits strings for conditional queries
Compile kernel modules separately
How to connect the API interface of Taobao open platform (super detailed)
Hundred days to complete the open source task of the domestic database opengauss -- openguass minimalist version 3.0.0 installation tutorial
初次使用腾讯云,解决只能使用webshell连接,不能使用ssh连接。
RHCSA1
Four common problems of e-commerce sellers' refund and cash return, with solutions
Talk about my drawing skills in my writing career