```
public double pow(double x, int n) {
if (n < 0) {
n = -n;
x = 1/x;
}
double result = 1;
// And for Last executed input: 1.00000, -2147483648, "Time Limit Exceeded" accurs
while (true) {
int j = n&1;
n = n>>1;
if (j == 1) result *= x;
if (n == 0) break;
x = x*x;
}
return result;
}
```