当前位置:网站首页>(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 边栏推荐
- 深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
- 程序员代码面试指南 CD15 生成窗口最大值数组
- (more than 2022 cattle school four) A - Task Computing + dynamic programming (sort)
- EntityFramework saves to SQLServer decimal precision is lost
- (2022牛客多校四)A-Task Computing (排序+动态规划)
- Pyspark机器学习:向量及其常用操作
- 56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)
- Excel做题记录——整数规划优化模型
- Game Theory (Depu) and Sun Tzu's Art of War (42/100)
- typescript25-类型断言
猜你喜欢

The difference between scheduleWithFixedDelay and scheduleAtFixedRate

typescript28-枚举类型的值以及数据枚举

scheduleWithFixedDelay和scheduleAtFixedRate的区别

认真对待每一个时刻

How to promote new products online?

typescript20-接口

Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink
![Invalid classes inferred from unique values of `y`. Expected: [0 1 2], got [1 2 3]](/img/53/3dc2233498db78b8480084ce496f0b.png)
Invalid classes inferred from unique values of `y`. Expected: [0 1 2], got [1 2 3]

typescript22-接口继承

博客系统(完整版)
随机推荐
风险策略调优中重要的三步分析法
Optional parameters typescript19 - object
(2022牛客多校四)D-Jobs (Easy Version)(三维前缀或)
High Numbers | 【Re-integration】Line Area Score 880 Examples
Interview Blitz 69: Is TCP Reliable?Why?
UE4 模型OnClick事件不生效的两种原因
一个往年的朋友
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
程序员代码面试指南 CD15 生成窗口最大值数组
typescript28 - value of enumeration type and data enumeration
safari浏览器怎么导入书签
Difference Between Compiled and Interpreted Languages
Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
初识shell脚本
"ArchSummit: The cry of the times, technical people can hear"
基于ProXmoX VE的虚拟化家庭服务器(篇一)—ProXmoX VE 安装及基础配置
数组问题之《两数之和》以及《三数之和 》
The Principle Of Percona Toolkit Nibble Algorithm
This article takes you to understand the past and present of Mimir, Grafana's latest open source project
干货!如何使用仪表构造SRv6-TE性能测试环境