当前位置:网站首页>Correlation of XOR / and
Correlation of XOR / and
2022-06-26 14:23:00 【Honestbutter-】
Niuke winter vacation training camp H- Xiaosha's number
From the nature of XOR , Because the sum of the elements is m, The first m Convert to binary ,
To maximize the exclusive or of each element , It is necessary to ensure that all elements cannot be duplicated in the same bit under the binary system 1 So when m One of them 1, Only on the n A digit in a number .
Just statistics m How many are there in binary 1, every last 1 Can be placed in n In a position . The final result is n x n^x nx
#include <bits/stdc++.h>
using namespace std;
constexpr int mod = 1e9 + 7;
typedef long long LL;
LL n, m;
int main()
{
scanf("%lld%lld", &n, &m);
LL res=1;
n%=mod; // This must be added with ,res*n Explosive longlong
while(m)
{
if(m&1) res=res*n%mod;
m>>=1;
}
printf("%lld",res);
return 0;
}
边栏推荐
- Sword finger offer 06.24.35 Linked list
- Caelus - full scene offline mixed Department solution
- Sword finger offer 18.22.25.52 Double pointer (simple)
- Correlation analysis related knowledge
- Research on balloon problem
- Memory considerations under bug memory management
- 1075 pat judge (25 points)
- C language | file operation and error prone points
- Pycharm远程连接服务器来跑代码
- VIM auto fill auto indent explanation
猜你喜欢

从Celsius到三箭:加密百亿巨头们的多米诺,史诗级流动性的枯竭

服务器创建虚拟环境跑代码

Gartner 2022 Top Strategic Technology Trends Report

Sword finger offer 21.57.58 I Double pointer (simple)

Server create virtual environment run code

Never use redis expired monitoring to implement scheduled tasks!

程序员必备,一款让你提高工作效率N倍的神器uTools

9項規定6個嚴禁!教育部、應急管理部聯合印發《校外培訓機構消防安全管理九項規定》

Common operation and Principle Exploration of stream

Win10 home vs pro vs enterprise vs enterprise LTSC
随机推荐
Gee - Global Human Settlements grid data 1975-1990-2000-2014
Mathematical design D12 according to string function
(improved) bubble sorting and (improved) cocktail sorting
Relevant knowledge of information entropy
[hnoi2010] flying sheep
Sword finger offer 10 Ⅰ 10Ⅱ. 63 dynamic planning (simple)
[sdoi2013] forest
《三体》摘录
从Celsius到三箭:加密百亿巨头们的多米诺,史诗级流动性的枯竭
MHA高可用配合及故障切换
虫子 运算符重载的一个好玩的
Self created notes (unique in the whole network, continuously updated)
登录认证服务
永远不要使用Redis过期监听实现定时任务!
Pychar remotely connects to the server to run code
STM32F1和GD32F1有什么区别?
From Celsius to the three arrows: encrypting the domino of the ten billion giants, and drying up the epic liquidity
Half search, character array definition, character array uses D11
8. Ribbon load balancing service call
Hard (magnetic) disk (I)