You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
400 B
C++
19 lines
400 B
C++
#include <cstdio>
|
|
using namespace std;
|
|
typedef unsigned long long ll;
|
|
ll mod = 1e9 + 7;
|
|
ll qpow(ll a, ll b)
|
|
{
|
|
ll ans = 1;
|
|
for (; b; b >>= 1, a = a * a % mod)
|
|
if (b & 1)
|
|
ans = ans * a % mod;
|
|
return ans;
|
|
}
|
|
int main()
|
|
{
|
|
ll n, k, t = 0;
|
|
while (~scanf("%llu%llu", &n, &k))
|
|
printf("Case #%llu: %llu\n", ++t, qpow(n%mod, k));
|
|
return 0;
|
|
} |