qpow

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
long long b,p;
long long qpow(long long base,long long v)
{
long long ans=1;
while(v>0)
{
if(v&1)ans=ans*base;
base=base*base;
v>>=1;
}
return ans;
}

int main()
{
scanf("%lld%lld",&b,&p);
printf("%lld",qpow(b,p));
return 0;
}
显示 Gitment 评论