标签:while 快速 tps include ble highlight ret can name
网址:https://www.acwing.com/problem/content/91/
快速幂取模板子题。
AC代码:
#include <bits/stdc++.h> using namespace std; long long inv(long long a, long long b, long long p) { long long res = 1; while (b) { if (b & 1) res = (res * a) % p; a = (a * a) % p; b >>= 1; } return res % p; } int main() { long long a, b, p; scanf("%lld%lld%lld", &a, &b, &p); printf("%lld\n", inv(a, b, p)); return 0; }
标签:while 快速 tps include ble highlight ret can name
原文地址:https://www.cnblogs.com/Aya-Uchida/p/11470201.html