当前位置:网站首页>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)
总结
位运算不行
数学不行
边栏推荐
- Yyds dry inventory JS intercept file suffix
- Comprehensive upgrade of Taobao short video photosynthetic platform
- What is the difference between Bi software in the domestic market
- NLP engineer learning summary and index
- Transactions from December 27 to 28, 2021
- Pytoch monolayer bidirectional_ LSTM implements MNIST and fashionmnist data classification
- Laravel文档阅读笔记-mews/captcha的使用(验证码功能)
- Keras implements verification code identification
- SAP UI5 FlexibleColumnLayout 控件介绍
- 【云原生】Nacos中的事件发布与订阅--观察者模式
猜你喜欢

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

stm32和电机开发(从架构图到文档编写)

我在滴滴做开源

SAP UI5 FlexibleColumnLayout 控件介绍

Volatile instruction rearrangement and why instruction rearrangement is prohibited

Resnet+attention project complete code learning

Taobao, pinduoduo, jd.com, Doudian order & Flag insertion remarks API solution

Taobao order amount check error, avoid capital loss API

激动人心!2022开放原子全球开源峰会报名火热开启!

From the perspective of technology and risk control, it is analyzed that wechat Alipay restricts the remote collection of personal collection code
随机推荐
I'm doing open source in Didi
Transactions on December 23, 2021
Distributed solution - distributed session consistency problem
Kotlin函数
Tips and tricks of image segmentation summarized from 39 Kabul competitions
【云原生】Nacos-TaskManager 任务管理的使用
#yyds干货盘点#js截取文件后缀名
stirring! 2022 open atom global open source summit registration is hot!
非技术部门,如何参与 DevOps?
A possible investment strategy and a possible fuzzy fast stock valuation method
Vonedao solves the problem of organizational development effectiveness
I met Tencent in the morning and took out 38K, which showed me the basic smallpox
How to connect the API interface of Taobao open platform (super detailed)
Shi Zhenzhen's 2021 summary and 2022 outlook | colorful eggs at the end of the article
Transactions from January 14 to 19, 2022
RHCSA3
Halcon 模板匹配实战代码(一)
SAP UI5 ObjectPageLayout 控件使用方法分享
SAP UI5 视图里的 OverflowToolbar 控件
JDBC -- use JDBC connection to operate MySQL database