徐州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 ...
随机推荐
- 并发——详细介绍CAS机制
一.前言 今天花了点时间了解了一下JDK1.8中ConcurrentHashMap的实现,发现它实现的主要思想就是依赖于CAS机制.CAS机制是并发中比较重要的一个概念,所以今天这篇博客就来详细介 ...
- iSCSI集群与存储
...
- adb工作常用命令
adb devices 查看手机名 adb shell链接手机 dumpsys window windows |grep -i current 打开软件,查看软件入口,和包名,白色为包名,红框为包入口 ...
- 从零搭建一个SpringCloud项目之Zuul(四)
整合Zuul 为什么要使用Zuul? 易于监控 易于认证 减少客户端与各个微服务之间的交互次数 引入依赖 <dependency> <groupId>org.springfra ...
- 如果你的 pip 命令不能用,你可以这样解决
文章更新于:2020-04-05 注:如果想了解 pip 参数的使用参见:pip 命令参数以及如何配置国内镜像源 如何解决 pip 不能用的问题 一.你可能会遇到的问题 1.检查你敲命令的位置 2.如 ...
- iphone se2的优缺点分析:
4月15日晚间消息,在毫无征兆的情况下苹果公司刚刚正式发布iPhone SE二代手机,这款传闻多年的产品终于出现,国内定价人民币3299元起.本周五开始预定,4月24日开始送货. Phone SE ...
- "首字母变大写"组件:<capitalize> —— 快应用组件库H-UI
 <import name="capitalize" src="../Common/ui/h-ui/text/c_text_capitalize"> ...
- ASP.NET Core 3.1+MySQL 部署到docker上面使用docker-compose+DockerFile
一.新建DockerFile文件 选择Linux版本 FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base WORKDIR ...
- Altium Designer 3D
- 微信小程序与H5数据传递
这的场景是 小程序webview 加载 H5应用 需求点: 1. 小程序的登录code 需要与H5应用的sessionId建立绑定关系 2.H5内发起微信小程序支付,支付参数传递到小程序,支付结果传递 ...