Product of Divisors

Can someone tell what is wrong with my program at CodeChef: Practical coding for everyone for the problem Product of Divisors at D1 Problem - CodeChef

1 Like

@agnelvishal hi here is a little optimization…use squaring for last ans calculation…where u had calculated value of a…then use squaring method to reduce little complexity and try other …

Sorry but I did not understand what is squaring and where did you ask to use it.

@agnelvishal …for calculating pow(N,a)…in log(a) complexity here is little psuedo code
Complexity : O(log(POW))
#define MOD 1000000007

long long int (long long int N,long long int POW)
{
if(POW<=0) return 1;
if(N==1) return 1;
long long int ans=1;
while(POW)
{
if(POW%2){
ans*=N;
POW–;
if(ans>=MOD) ans%=MOD;
}
N*=N;
POW/=2;
if(N>=MOD) N%=MOD;
}
}

here is my solution link…CodeChef: Practical coding for everyone

what is wrong with my solution??

can u find error??