徐州A
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define ms(arr,a) memset(arr,a,sizeof arr)
#define debug(x) cout<<"< "#x" = "<<x<<" >"<<endl
const int mod=1e9+7;
int quick_pow(int a,int n)
{
int ret=1;
while(n)
{
if(n&1)ret=1LL*ret*a%mod;
a=1LL*a*a%mod;
n>>=1;
}
return ret;
}
int n,k,ek;
int main()
{
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
int t;scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&k);
ek=quick_pow(2,k);
int ans=ek;
for(int i=(n&1)+2;i<=n;i=i+2)
{
ans=(1LL*ans+1LL*ek*(ek-2)%mod*quick_pow(ek-1,i-2)%mod)%mod;
//debug(ans);
}
printf("%d\n",ans);
}
//freopen("CON","w",stdout);
//system("start Output.txt");
}
徐州A的更多相关文章
- Trace 2018徐州icpc网络赛 (二分)(树状数组)
Trace There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx ...
- 2018 ICPC 徐州网络赛
2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution ...
- 徐州网络赛B-BE,GE or NE【记忆化搜索】【博弈论】
In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...
- 徐州网络赛A-Hard To Prepare【dp】【位运算】【快速幂】
After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a ...
- 徐州网络赛J-Maze Designer【最小生成树】【LCA】
After the long vacation, the maze designer master has to do his job. A tour company gives him a map ...
- 徐州网络赛G-Trace【线段树】
There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy ...
- 徐州网络赛H-Ryuji doesn't want to study【线段树】
Ryuji is not a good student, and he doesn't want to study. But there are n books he should learn, ea ...
- 徐州网络赛F-Feature Trace【暴力】
Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat moveme ...
- 徐州网络赛C-Cacti Lottery【DFS】
54.19% 2000ms 262144K Morgana is playing a game called cacti lottery. In this game, morgana has a 3 ...
- 计蒜客 1460.Ryuji doesn't want to study-树状数组 or 线段树 (ACM-ICPC 2018 徐州赛区网络预赛 H)
H.Ryuji doesn't want to study 27.34% 1000ms 262144K Ryuji is not a good student, and he doesn't wa ...
随机推荐
- Linux 常用命令(遇见了,就记录了 ,随缘吧)
1.实时查看最后日志(默认10条) # tail -f xxxxxx.log 2.查看结尾多少条日志 # tail -n30 -f xxxx.log 3.根据关键字查询日志 # cat xxxxx.l ...
- HTML、PHP、CSS、JS之间的关系
23:02:06 2019-08-05 自己要搭建网站 虽然可以下载大佬的界面 但至少要懂一点web开发的知识 我现在感觉像个憨憨 啥都不明白 转载自:知乎 https://www.zhihu.com ...
- 标准与扩展ACL
标准与扩展ACL 案例1:配置标准ACL 案例2:配置扩展ACL 案例3:配置标准命名ACL 配置扩展命名ACL 1 案例1:配置标准ACL 1.1 问题 络调通后,保证网络是通畅的.同时也很可能出现 ...
- ansible--ansible基础
配置文件 ansible的配置文件只有一个,即ansible.cfg,它可以存在于多个地方,ansible读取配置文件的顺序依次是当前命令执行目录->用户家目录下的.ansible.cfg-&g ...
- webstorm 永久激活方法
打开终端,执行: cd /etc/ sudo vim hosts 在最后一行加上: 0.0.0.0 account.jetbrains.com 打开webstorm,选择Activation Code ...
- Python库-Pandas
Pandas是基于NumPy的一种数据分析工具,提供了大量使我们快速便捷处理数据的函数和方法. 中文官网地址:https://www.pypandas.cn Pandas基于两种数据类型:Series ...
- HAproxy shell脚本安装
#!/bin/bash #需要lua-..tar.gz在家目录下 # 编译安装lua #安装编译环境需要的包 yum -y install gcc openssl-devel pcre-devel s ...
- [leetcode]1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
[leetcode]1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree 链接 leetcode 描述 ...
- split(" {1,}") 含义
将字符串按照括号内的内容分割成字符数组 这里括号内是正则表达式,X{m,n}代表X至少重复m次,至多重复n次 这里x为空格,至少重复1次,就是将字符串以一个或多个空格分割 如"1 2 ab ...
- ArrayBlockingQueue和LinkedBlockingQueue的使用
ArrayBlockingQueue和LinkedBlockingQueue的使用 博客分类: java.util.concurrent BlockingQueue接口定义了一种阻塞的FIFO q ...