当前位置:网站首页>(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 边栏推荐
- 智芯传感输液泵压力传感器 为精准智能控制注入科技“强心剂”
- Lawyer Interpretation | Guns or Roses?Talking about Metaverse Interoperability from the Battle of Big Manufacturers
- API设计笔记:pimpl技巧
- 出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
- typescript26 - literal types
- 基于ProXmoX VE的虚拟化家庭服务器(篇一)—ProXmoX VE 安装及基础配置
- 时时刻刻保持敬畏之心
- Write a method to flatten an array and deduplicate and sort it incrementally
- SQL Analysis of ShardingSphere
- [target detection] YOLOv7 theoretical introduction + practical test
猜你喜欢

【目标检测】YOLOv7理论简介+实践测试

【无标题】

Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)

The difference between scheduleWithFixedDelay and scheduleAtFixedRate

Pyspark机器学习:向量及其常用操作

typescript26-字面量类型

博客系统(完整版)

剑指 Offer 68 - II. 二叉树的最近公共祖先

API Design Notes: The pimpl trick

基于STM32设计的UNO卡牌游戏(双人、多人对战)
随机推荐
高数 | 【重积分】线面积分880例题
UE4 模型OnClick事件不生效的两种原因
开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
UE4 从鼠标位置射出射线检测
数组问题之《下一个排列》、《旋转图像》以及二分查找之《搜索二维矩阵》
出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
25. 这三道常见的面试题,你有被问过吗?
typescript26-字面量类型
C# | 使用Json序列化对象时忽略只读的属性
Game Theory (Depu) and Sun Tzu's Art of War (42/100)
PMP子过程定义总结
【云原生之kubernetes实战】kubernetes集群的检测工具——popeye
(2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)
leetcode:126. Word Solitaire II
Flutter Tutorial 01 Configure the environment and run the demo program (tutorial includes source code)
Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink
Pyspark机器学习:向量及其常用操作
typescript21 - Comparison of Interfaces and Type Aliases
(2022牛客多校四)K-NIO‘s Sword(思维)
请问shake数据库中为什么读取100个collection 后,直接就退出了,不继续读了呢?