link of the problem http://www.codechef.com/problems/D1/
Here is the link of my ans
http://www.codechef.com/viewsolution/6783767
I have used the studied the blog http://blog.codechef.com/2009/08/17/tutorial-for-problem-product-of-divisors/
and calculate the power n^p(in O(logn)).But I am getting runtime error.plz help