UVa 113 - Power of Cryptography

Summary
Given p and n, calculate $$\sqrt[n]{p}$$. We can solve this by using Logarithms.

Explanation
Recall that in Logarithms:

$$k^n = p$$

is equivalent to

$$\ln{ k^n } = \ln{ p }$$

which is simply

$$n \ln{ k }= \ln{ p }$$

or

$$\ln{ k }= \frac{\ln{ p }}{n}$$

thus k is:

$$k = e^{(\frac{\ln{ p}}{n})}$$

Input
2 16 3 27 7 4357186184021382204544

Output
4 3 1234

Solution
C++: http://acm-solution.blogspot.com/2011/09/acm-uva-113-power-of-cryptography.html