当前位置:网站首页>(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 5
Sample output:
54/5
Title:
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
边栏推荐
- 万字逐行解析与实现Transformer,并进行德译英实战(二)
- Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink
- 微软 Win10 照片磁贴后的又一“刺客”,谷歌 Chrome 浏览器将在新标签页展示用户照片
- What is a programming language
- Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
- 25. Have you been asked these three common interview questions?
- Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)
- 万字逐行解析与实现Transformer,并进行德译英实战(一)
- IJCAI2022 | Hybrid Probabilistic Reasoning with Algebraic and Logical Constraints
- 报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
猜你喜欢
微软 Win10 照片磁贴后的又一“刺客”,谷歌 Chrome 浏览器将在新标签页展示用户照片
typescript27-枚举类型呢
【无标题】
出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
typescript21 - Comparison of Interfaces and Type Aliases
(2022牛客多校四)H-Wall Builder II(思维)
Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
typescript26-字面量类型
typescript26 - literal types
2022-07-31: Given a graph with n points and m directed edges, you can use magic to turn directed edges into undirected edges, such as directed edges from A to B, with a weight of 7.After casting the m
随机推荐
FFmpeg 搭建本地屏幕录制环境
7月编程排行榜来啦!这次有何新变化?
Typescript20 - interface
状态压缩dp
EntityFramework saves to SQLServer decimal precision is lost
Flink 1.13 (8) CDC
(more than 2022 cattle school four) A - Task Computing + dynamic programming (sort)
UE4 从鼠标位置射出射线检测
Difference Between Compiled and Interpreted Languages
今日睡眠质量记录68分
(2022牛客多校四)A-Task Computing (排序+动态规划)
Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)
初识shell脚本
typescript25 - type assertion
罗技鼠标体验记录
PMP子过程定义总结
In the shake database, I want to synchronize the data of the source db0 to the destination db5, how to set the parameters?
怀念故乡的面条
万字逐行解析与实现Transformer,并进行德译英实战(一)
最新 955 不加班的公司名单