下你所需,载你所想!
汇集开发技术源码资料

快速幂算法(binary-power.c)

:544B :1 :2022-09-29 14:31:45

部分简介

快速幂算法(binary-power.c)如果开发者对于本文件有需要的可以参考。
int main()
{
unsigned long long qick_pow1(unsigned long long a, unsigned long long n, unsigned long long p);
unsigned long long qick_pow2(unsigned long long a, unsigned long long n, unsigned long long p);
unsigned long long qick_pow3(unsigned long long a, unsigned long long n, unsigned long long p);
unsigned long long a, n, p;
scanf("%llu %llu %llu", &a, &n, &p);
printf("%llu\n", qick_pow1(a, n, p));
printf("%llu\n", qick_pow2(a, n, p));
printf("%llu\n", qick_pow3(a, n, p));
printf("%llu\n", (unsigned long long)pow(a, n) % p);
}

热门推荐

相关文章