当前位置:网站首页>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 to connect the API interface of Taobao open platform (super detailed)
- Transactions from December 27 to 28, 2021
- 事务的基本特性和隔离级别
- 奔跑,开路
- Reshape the power of multi cloud products with VMware innovation
- 跨平台(32bit和64bit)的 printf 格式符 %lld 输出64位的解决方式
- HiEngine:可媲美本地的云原生内存数据库引擎
- SAP UI5 FlexibleColumnLayout 控件介绍
- ##无监控,不运维,以下是监控里常用的脚本监控
- Didi open source Delta: AI developers can easily train natural language models
猜你喜欢
SAP UI5 视图里的 OverflowToolbar 控件
Comprehensive upgrade of Taobao short video photosynthetic platform
946. Verify stack sequence
初次使用腾讯云,解决只能使用webshell连接,不能使用ssh连接。
Why is your next computer a computer? Explore different remote operations
谈谈我写作生涯的画图技巧
Introduction to sap ui5 flexiblecolumnlayout control
A few years ago, I outsourced for four years. Qiu Zhao felt that life was like this
RHCSA3
潘多拉 IOT 开发板学习(HAL 库)—— 实验7 窗口看门狗实验(学习笔记)
随机推荐
初识Linkerd项目
Talk about my drawing skills in my writing career
JXL notes
关于 SAP UI5 floating footer 显示与否的单步调试以及使用 SAP UI5 的收益
Notes for preparation of information system project manager --- information knowledge
2021-12-22 transaction record
Yyds dry inventory JS intercept file suffix
Tips and tricks of image segmentation summarized from 39 Kabul competitions
《信息系统项目管理师》备考笔记---信息化知识
MySQL splits strings for conditional queries
HiEngine:可媲美本地的云原生内存数据库引擎
LeetCode20.有效的括号
Taobao short video, why the worse the effect
SAP SEGW 事物码里的 Association 建模方式
国内市场上的BI软件,到底有啥区别
jxl笔记
stirring! 2022 open atom global open source summit registration is hot!
《2022年中国银行业RPA供应商实力矩阵分析》研究报告正式启动
Hundred days to complete the open source task of the domestic database opengauss -- openguass minimalist version 3.0.0 installation tutorial
I'm doing open source in Didi