当前位置:网站首页>(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 边栏推荐
- 李迟2022年7月工作生活总结
- [target detection] YOLOv7 theoretical introduction + practical test
- 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
- TIM登陆时提示00001(TIM00001)
- typescript20-接口
- Logitech Mouse Experience Record
- PAT乙级 1001 害死人不偿命的(3n+1)猜想
- 6-23漏洞利用-postgresql代码执行利用
- ICML2022 | Deep Dive into Permutation-Sensitive Graph Neural Networks
- (2022 Nioke Duo School IV) D-Jobs (Easy Version) (3D prefix or)
猜你喜欢

智芯传感输液泵压力传感器 为精准智能控制注入科技“强心剂”

深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!

Typescript22 - interface inheritance

Risk strategy important steps of tuning method

云服务器下载安装mongo数据库并远程连接详细图文版本(全)

typescript23-元组

今日睡眠质量记录68分

y83. Chapter 4 Prometheus Factory Monitoring System and Actual Combat -- Advanced Prometheus Alarm Mechanism (14)

Difference Between Compiled and Interpreted Languages

开源许可证 GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
随机推荐
Immutable
出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
Logitech Mouse Experience Record
【愚公系列】2022年07月 Go教学课程 024-函数
LeetCode 1189. “气球” 的最大数量
Advice given by experts with four years of development experience in Flutter tutorial
Flutter Tutorial 02 Introduction to Flutter Desktop Program Development Tutorial Run hello world (tutorial includes source code)
解决ffmpeg使用screen-capture-recorder录屏,有屏幕缩放的情况下录不全的问题
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (2)
在互联网时代,有诸多「互联网+」模式的诞生
一个往年的朋友
Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink
请问表格储存中用sql只能查询到主键列,ots sql非主键不支持吗?
【愚公系列】2022年07月 Go教学课程 025-递归函数
干货!如何使用仪表构造SRv6-TE性能测试环境
Pyspark Machine Learning: Vectors and Common Operations
【kali-信息收集】枚举——DNS枚举:DNSenum、fierce
typescript23-元组
MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
25. Have you been asked these three common interview questions?