当前位置:网站首页>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
边栏推荐
- Actual combat simulation │ JWT login authentication
- Hiengine: comparable to the local cloud native memory database engine
- Compile kernel modules separately
- 滴滴开源DELTA:AI开发者可轻松训练自然语言模型
- PyCharm安装第三方库图解
- SAP UI5 视图里的 OverflowToolbar 控件
- 无密码身份验证如何保障用户隐私安全?
- Compilation principle reading notes (1/12)
- 实现 1~number 之间,所有数字的加和
- Pandora IOT development board learning (HAL Library) - Experiment 7 window watchdog experiment (learning notes)
猜你喜欢

2021-12-22 transaction record

Transactions from January 14 to 19, 2022

Research: data security tools cannot resist blackmail software in 60% of cases

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

946. Verify stack sequence

你的下一台电脑何必是电脑,探索不一样的远程操作

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

leetcode:221. 最大正方形【dp状态转移的精髓】

SAP UI5 DynamicPage 控件介绍

深度长文探讨Join运算的简化和提速
随机推荐
深度长文探讨Join运算的简化和提速
##无监控,不运维,以下是监控里常用的脚本监控
RHCAS6
From the perspective of technology and risk control, it is analyzed that wechat Alipay restricts the remote collection of personal collection code
2021-12-22 transaction record
HiEngine:可媲美本地的云原生内存数据库引擎
Notes for preparation of information system project manager --- information knowledge
Discussion on error messages and API versions of SAP ui5 getsaplogonlanguage is not a function
OpenHarmony应用开发之Navigation组件详解
使用 jMeter 对 SAP Spartacus 进行并发性能测试
Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution
How to connect the API interface of Taobao open platform (super detailed)
I'm doing open source in Didi
国内市场上的BI软件,到底有啥区别
Natural language processing series (I) introduction overview
初次使用腾讯云,解决只能使用webshell连接,不能使用ssh连接。
946. 验证栈序列
以VMware创新之道,重塑多云产品力
jxl笔记
Run, open circuit