当前位置:网站首页>B. AND 0, Sum Big-Codeforces Round #716 (Div. 2)
B. AND 0, Sum Big-Codeforces Round #716 (Div. 2)
2022-06-23 17:21:00 【Qin Sanma】
B. AND 0, Sum Big
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
Baby Badawy's first words were "AND 0 SUM BIG", so he decided to solve the following problem. Given two integers nn and kk, count the number of arrays of length nn such that:
- all its elements are integers between 00 and 2k−12k−1 (inclusive);
- the bitwise AND of all its elements is 00;
- the sum of its elements is as large as possible.
Since the answer can be very large, print its remainder when divided by 109+7109+7.
Input
The first line contains an integer tt (1≤t≤101≤t≤10) — the number of test cases you need to solve.
Each test case consists of a line containing two integers nn and kk (1≤n≤1051≤n≤105, 1≤k≤201≤k≤20).
Output
For each test case, print the number of arrays satisfying the conditions. Since the answer can be very large, print its remainder when divided by 109+7109+7.
Example
input
Copy
2 2 2 100000 20
output
Copy
4 226732710
Note
In the first example, the 44 arrays are:
- [3,0][3,0],
- [0,3][0,3],
- [1,2][1,2],
- [2,1][2,1].
==================================================================================================================================================
& The operation requires that only one of them be 0 The result must be 0, And if we want to maximize the results , The best way is, of course n individual 2^k-1, But this and the operation are not 0,. We can get n-1 All numbers 2^k-1, There's one left 0, That is to say k All places are 0 The situation of . But this k A place is 0 The case is randomly assigned to n A number does not affect the size of the answer , So the answer is n^k, It can be solved quickly
# include<iostream>
# define mod 1000000007
using namespace std;
typedef long long int ll;
ll quickpow(ll base, ll pow)
{
ll ans=1;
while(pow)
{
if(pow&1)
ans=ans*base%mod;
pow>>=1;
base=base*base%mod;
}
return ans;
}
int main ()
{
int t;
cin>>t;
while(t--)
{
ll n,k;
cin>>n>>k;
cout<<quickpow(n,k)<<endl;
}
return 0;
}
边栏推荐
- 10分钟后性能测试瓶颈调优!想进大厂这个必须会
- 出现Identify and stop the process that‘s listening on port 8080 or configure this application等解决方法
- ctfshow php的特性
- Freemark uses FTL files to generate word
- Comparison of asemi Schottky diode and ultrafast recovery diode in switching power supply
- ERP管理系统的重要性
- QT布局管理器【QVBoxLayout,QHBoxLayout,QGridLayout】
- R language ggplot2 visualizes horizontal boxplot with coord_flip, and adds jittered data points to display the distribution
- 数据库 实验二 查询
- MySQL事务及其特性与锁机制
猜你喜欢

网络远程访问树莓派(VNC Viewer)

EasyPlayer移动端播放webrtc协议时长按播放页面无法关闭“关于我们”页面

《MPLS和VP体系结构》

微信小程序:酒店预计到店日期的时间选择器

Easyplayer mobile terminal plays webrtc protocol for a long time. Pressing the play page cannot close the "about us" page

Can the asemi fast recovery diodes RS1M, us1m and US1G be replaced with each other

Importance and purpose of test

使用Jmeter进行性能测试及性能监控平台搭建
![QT layout manager [qvboxlayout, qhboxlayout, qgridlayout]](/img/62/a0425a325f123ba91a7a69cf854d2c.png)
QT layout manager [qvboxlayout, qhboxlayout, qgridlayout]

Jetpack compose and material you FAQs
随机推荐
EasyPlayer移动端播放webrtc协议时长按播放页面无法关闭“关于我们”页面
测试的重要性及目的
根据年份获取第一天和最后一天
Asemi ultrafast recovery diode es1j parameters, es1j package, es1j specification
How do you choose to buy stocks? Good security?
【30. 串联所有单词的子串】
Query the size of each table in the database
官方零基础入门 Jetpack Compose 的中文课程来啦
NLP paper reading | improving semantic representation of intention recognition: isotropic regularization method in supervised pre training
TQ of R language using tidyquant package_ The transmute function calculates the daily, monthly and weekly returns of a stock. Ggplot2 uses the bar plot to visualize the monthly return data of the stoc
《MPLS和VP体系结构》
What can the accelerated implementation of digital economy bring to SMEs?
时间戳90K是什么意思?
亚朵更新招股书:继续推进纳斯达克上市,已提前“套现”2060万元
TensorRT Paser加载onnx 推理使用
bypassuac提权
Elk log collection system deployment
C#与数据库连接
Get first and last days by year
QT布局管理器【QVBoxLayout,QHBoxLayout,QGridLayout】