Exponent Calculation

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Java

In mathematics, there is a very special constant that can help with calculating exponents. The constant e, which is approximately 2.71828182845904523536 can calculate x^y using the formula e^{y * log(x)}. Using the following Java methods, use e to calculate an exponent, then use Math.pow to calculate it again.

Math.exp(double) // Raises the constant e to the power of the given double.
Math.log(double) // Gives the natural logarithm of the given double.

Input

The first line of input contains x (1 \le x \le 100).
The next line of input contains y (1 \le y \le 100).

Output

On the first line, output the calculated value of x^y using the formula e^{y * log(x)}.
On the next line, output the value of x^y using the Math.pow method.

Sample Input

7
5

Sample Output

16806.99999999998
16807.0

Comments

There are no comments at the moment.