//big mod using dinamic programming
long square(long c)
{
return c*c;
}
long bigmod(long b,long p,long m)
{
if (p==0)
return 1;
else if (p%2==0)
return square(bigmod(b,p/2,m)%m)%m;
else
return ((b%m)*(bigmod(b,p-1,m)%m))%m;
}
1 comment:
Thanks dude...age old Headache got cured...:)
Post a Comment