当前位置:网站首页>CF:A. The Third Three Number Problem【关于我是位运算垃圾这个事情】
CF:A. The Third Three Number Problem【关于我是位运算垃圾这个事情】
2022-07-05 12:40:00 【白速龙王的回眸】

分析
在比赛过程中我自创了异或的分配律,直接把自己无语到了
首先我们要善用异或的性质
a ^ 0 = a
a ^ a = 0
若a ^ b = c 则c ^ b = a
^有结合律没有分配律
因此,对于a是偶数来说,显然a // 2, 0, 0就是一组解,我晕
关于a是奇数不成立的证明
关于a + b和a ^ b同奇偶的证明
若a + b是偶,说明a和b同奇偶,也就是最后一位相同,所以a ^ b最后一位是0,所以a ^ b 也是偶
若a + b是奇,说明a和b最后一位相异,所以a ^ b最后一位是1,所以a ^ b是奇数
借助上述引理,已知(a ^ b) + (b ^ c) + (c ^ a) = n
又有(a ^ b) ^ (b ^ c) = a ^ c
所以一开始的式子可以化简为x + y + (x ^ y) = n
显然n是偶数
无语
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)
总结
位运算不行
数学不行
边栏推荐
- 【Nacos云原生】阅读源码第一步,本地启动Nacos
- 深度长文探讨Join运算的简化和提速
- Pytoch counts the number of the same elements in the tensor
- 关于 SAP UI5 getSAPLogonLanguage is not a function 的错误消息以及 API 版本的讨论
- Rasa Chat Robot Tutorial (translation) (1)
- What is the difference between Bi software in the domestic market
- Neural network of PRML reading notes (1)
- Transactions from January 6 to October 2022
- Programming skills for optimizing program performance
- 从39个kaggle竞赛中总结出来的图像分割的Tips和Tricks
猜你喜欢

How to connect the API interface of Taobao open platform (super detailed)

Principle of universal gbase high availability synchronization tool in Nanjing University

Pytoch monolayer bidirectional_ LSTM implements MNIST and fashionmnist data classification

Volatile instruction rearrangement and why instruction rearrangement is prohibited

OPPO小布推出预训练大模型OBERT,晋升KgCLUE榜首

Lepton 无损压缩原理及性能分析

Distributed cache architecture - cache avalanche & penetration & hit rate

About LDA model

2021.12.16-2021.12.20 empty four hand transaction records

非技术部门,如何参与 DevOps?
随机推荐
JDBC -- extract JDBC tool classes
View and terminate the executing thread in MySQL
2021-12-22 transaction record
ActiveMQ installation and deployment simple configuration (personal test)
Pytoch monolayer bidirectional_ LSTM implements MNIST and fashionmnist data classification
Simply take stock reading notes (2/8)
A deep long article on the simplification and acceleration of join operation
以VMware创新之道,重塑多云产品力
[cloud native] use of Nacos taskmanager task management
Distributed solution - Comprehensive decryption of distributed task scheduling platform -xxljob
A possible investment strategy and a possible fuzzy fast stock valuation method
stm32和电机开发(从架构图到文档编写)
SAP self-development records user login logs and other information
Using MySQL in docker
CVPR 2022 | 基于稀疏 Transformer 的单步三维目标识别器
Reshape the power of multi cloud products with VMware innovation
Taobao order amount check error, avoid capital loss API
使用 jMeter 对 SAP Spartacus 进行并发性能测试
Keras implements verification code identification
stirring! 2022 open atom global open source summit registration is hot!