您的位置:首页 > 其它

RXD and math HDU - 6063

2017-08-01 18:54 423 查看


Sample Input

10 10

Sample Output

Case #1: 999999937

打表找规律 快速幂

#include<cstdio>
using namespace std;
#define ll long long
const int mod=1e9+7;
///注意取余
ll pow(ll a,ll n)
{
ll text=1;
while (n)
{
if (n&1) text = (text%mod)*(a%mod)%mod;
a = (a%mod)*(a%mod)%mod;
n >>= 1;
}
return text;
}
int main()
{
ll n,k;
int i=1;
while(~scanf("%lld%lld",&n,&k))
{
ll text=pow(n,k);
printf("Case #%d: %lld\n",i++,text);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  math