4475: [Jsoi2015]子集选取
Time Limit: 1 Sec Memory Limit: 512 MBSubmit: 185 Solved: 132
[ Submit][ Status][ Discuss]
Description
Input
输入包含一行两个整数N和K,1<=N,K<=10^9
Output
一行一个整数,表示不同方案数目模1,000,000,007的值。
Sample Input
2 2
Sample Output
16
HINT
Source
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;
const LL mo = 1000000007;
int N,K;
int Mul(const LL &x,const LL &y) {return x * y % mo;}
int ksm(int x,int y)
{
int ret = 1;
for (; y; y >>= 1)
{
if (y & 1) ret = Mul(ret,x);
x = Mul(x,x);
}
return ret;
}
int main()
{
#ifdef DMC
freopen("DMC.txt","r",stdin);
#endif
cin >> N >> K;
cout << ksm(ksm(2,K),N) << endl;
return 0;
}