当前位置:网站首页>(2022 Niu Ke Duo School IV) N-Particle Arts (Thinking)
(2022 Niu Ke Duo School IV) N-Particle Arts (Thinking)
2022-08-01 04:50:00 【AC__dream】
Title: 
Sample input:
51 2 3 4 5Sample output:
54/5Title:
n particles, each with an energy ai.For a random collision of two pairs, if the energies of the two examples are a and b, respectively, then the energies of the two particles in one collision become a&b, a|b respectively.Find the variance of all particle energies after they have stabilized.
We analyze the results of the collision of two particles and we can find that for the binary bits of a and b, if the i-th bit is both 1, then the i-th bit of the energy of the two particles formed after the collision is both 1,If the i-th bit is both 0, then the i-th bit of the energy of the two particles formed after the collision is 0. If the i-th bit of the a-particle and b-particle energy before the collision is 1 and the other is 0, then the collision is formed.The i-th bit of the particle is also a 1 and a 0, but the 1 is on the particle after the OR operation, so it is easy to find that each collision will make the energy of a particle larger (or may remain unchanged), and the binary bit after the collisionThe number of 1s remains unchanged, but it is possible to transfer from 1 particle to another particle. Due to countless collisions, the 1s on the binary must be concentrated as much as possible on a few, The final stable state is that for any i and j, there are (ai|aj,ai&aj)=(ai,aj) or (ai|aj,ai&aj)=(aj,ai) .So we only need to count the number of occurrences of 1 in each of the n numbers given at the beginning.Assign n numbers, try to assign 1 to a number every time, and finally ask for the expectation.
One point to note is that because the number is relatively large, it may explode long long, so it is recommended to use __int128 for calculation directly.
Here is the code:
#include#include#include#include#include 边栏推荐
- 开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
- lambda
- typescript19-对象可选参数
- Excel record of integer programming optimization model to solve the problem
- PAT乙级 1002 写出这个数
- 怀念故乡的面条
- typescript23-tuple
- Flutter Tutorial 01 Configure the environment and run the demo program (tutorial includes source code)
- 请问shake数据库中想把源的db0的数据同步到目的db5,参数怎么设置呢?
- 故乡的素描画
猜你喜欢

Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink

Typescript22 - interface inheritance

typescript21 - Comparison of Interfaces and Type Aliases

(2022牛客多校四)N-Particle Arts(思维)

万字逐行解析与实现Transformer,并进行德译英实战(一)

typescript28 - value of enumeration type and data enumeration

Message queue design based on mysql

力扣(LeetCode)212. 单词搜索 II(2022.07.31)

这里有110+公开的专业数据集

What is dynamic programming and what is the knapsack problem
随机推荐
typescript25-类型断言
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
PMP 相关方管理必背总结
Step by step hand tearing carousel Figure 3 (nanny level tutorial)
PMP 80个输入输出总结
基于ProXmoX VE的虚拟化家庭服务器(篇一)—ProXmoX VE 安装及基础配置
25. Have you been asked these three common interview questions?
动态规划 01背包
56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)
Article summary: the basic model of VPN and business types
MLP neural network, GRNN neural network, SVM neural network and deep learning neural network compare and identify human health and non-health data
认真对待每一个时刻
【愚公系列】2022年07月 Go教学课程 024-函数
智芯传感输液泵压力传感器 为精准智能控制注入科技“强心剂”
ICML2022 | Deep Dive into Permutation-Sensitive Graph Neural Networks
开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
API Design Notes: The pimpl trick
Difference Between Compiled and Interpreted Languages
基于STM32设计的UNO卡牌游戏(双人、多人对战)
在互联网时代,有诸多「互联网+」模式的诞生