#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的更多相关文章

  1. Trace 2018徐州icpc网络赛 (二分)(树状数组)

    Trace There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx ...

  2. 2018 ICPC 徐州网络赛

    2018 ICPC 徐州网络赛 A. Hard to prepare 题目描述:\(n\)个数围成一个环,每个数是\(0\)~\(2^k-1\),相邻两个数的同或值不为零,问方案数. solution ...

  3. 徐州网络赛B-BE,GE or NE【记忆化搜索】【博弈论】

    In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...

  4. 徐州网络赛A-Hard To Prepare【dp】【位运算】【快速幂】

    After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a ...

  5. 徐州网络赛J-Maze Designer【最小生成树】【LCA】

    After the long vacation, the maze designer master has to do his job. A tour company gives him a map ...

  6. 徐州网络赛G-Trace【线段树】

    There's a beach in the first quadrant. And from time to time, there are sea waves. A wave ( xx , yy  ...

  7. 徐州网络赛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 ...

  8. 徐州网络赛F-Feature Trace【暴力】

    Morgana is learning computer vision, and he likes cats, too. One day he wants to find the cat moveme ...

  9. 徐州网络赛C-Cacti Lottery【DFS】

    54.19% 2000ms 262144K Morgana is playing a game called cacti lottery. In this game, morgana has a 3 ...

  10. 计蒜客 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 ...

随机推荐

  1. what the fuck!(二分查找 / 暴力模拟)

    what the fuck! Description 现在有一家公司有nnn个员工(nnn为奇数),他们的工资发放是基本工资+提成,现在这家公司计划再招一批人.要写一篇招聘启事,但是对于这个招聘启事中 ...

  2. python class类的属性应用及init初始化实践 ---勇者斗恶龙

    最近在熟悉python的基础语法,刚好老师布置了个课后作业感觉挺有意思的,就记录下来了学习过程. 题目如下: 刚拿到题目就想到了init 初始化属性,还列了下思路:(ps:notepad++写的比较糙 ...

  3. 1026 Table Tennis (30分)

    A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For a ...

  4. pyecharts数据可视化模块

    目录 安装 柱状图-Bar 饼图-Pie 箱体图-Boxplot 折线图-Line 雷达图-Rader 散点图-scatter 我们都知道python上的一款可视化工具matplotlib,而前些阵子 ...

  5. MTK Android SwitchPreference(设置-智能辅助-导航栏-导航栏可隐藏)

    1.界面布局文件 packages/apps/PrizeSettings/res/xml/navigation_bar_prize.xml ------------------------------ ...

  6. python 函数--递归函数

    一.递归函数的定义:在一个函数里面调用函数本身 python限制最大层数:998层 def foo(n): print(n) n+=1 foo(n) foo(1)

  7. Linux基础篇,Shell

    一.基本知识 Shell Script是一种脚本.可以用来极大的简化计算机的管理.在谱写shell script的时候,需要注意以下问题: 1. 指令的执行是从上而下. 从左而右的分析与执行: 2. ...

  8. Tcl编程第三天,数学运算

    1.tcl语言没有自己的数学计算,如果想要使用数学公式,必须得用C语言的库.使用方法如下. #!/usr/bin/tclsh set value [expr 8/5] puts $value set ...

  9. javascript 入门 之 bootstrap 第一个程序

    <table data-toggle="table"> <thead> <tr> <th>Item ID</th> &l ...

  10. foreach-- for循环的增强型:for(类型 变量 : 数组对象) { 使用变量 }

    /* * foreach:增强for循环,一般用于遍历集合或者数组 * 格式: * for(元素的类型 变量 : 集合或者数组对象) { * 可以直接使用变量; * } 注意:在增强for循环中不能修 ...