Bryce1010模板
http://acm.hdu.edu.cn/showproblem.php?pid=6063
打表发现规律是n^k
#include <iostream>
#include<string.h>
#include<cmath>
using namespace std;
#define ll long long
const int MOD=1e9+7;
const int MAXN=1e6;
bool check[MAXN+10];
int prime[MAXN+10];
int mu[MAXN+10];
void moblus()
{
memset(check,false,sizeof(check));
mu[1]=1;
int tot=0;
for(int i=2;i<MAXN;i++)
{
if(!check[i])
{
prime[tot++]=i;
mu[i]=-1;
}
for(int j=0;j<tot;j++)
{
if(i*prime[j]>MAXN)break;
check[i*prime[j]]=true;
if(i%prime[j]==0)
{
mu[i*prime[j]]=0;
break;
}
else
{
mu[i*prime[j]]=-mu[i];
}
}
}
}
ll pow_mod(ll a,ll n,ll mod)
{
ll ret=1;
//ll tmp=a%mod;
a=a%mod;
while(n)
{
if(n&1)ret=(ret*a)%mod;
a=a*a%mod;
n>>=1;
}
return ret%MOD;
}
int main()
{
ll n,k;
ll Case=1;
while(cin>>n>>k)
{
cout<<"Case #"<<Case++<<": "<<pow_mod(n,k,MOD)%MOD<<endl;
}
return 0;
}