快速幂不加判断
90分
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef unsigned long long ll;
const int N = 1e9;
int a, b;
ll f(int a, int b) {
if (!b)
return 1;
ll tmp = f(a, b / 2);
if (tmp > N)
return -1;
return (b % 2 ? a : 1) * tmp * tmp;
}
int main() {
scanf("%d %d", &a, &b);
ll sum = f(a, b);
if (sum > N)
printf("-1");
else
printf("%lld", sum);
return 0;
}