From 85c12c8df77cb63a50a61b8d883a2342237d561b Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 3 Jan 2021 10:23:06 +0800 Subject: [PATCH] =?UTF-8?q?#10194.=20=E3=80=8C=E4=B8=80=E6=9C=AC=E9=80=9A?= =?UTF-8?q?=206.1=20=E7=BB=83=E4=B9=A0=201=E3=80=8DA=20=E7=9A=84=20B=20?= =?UTF-8?q?=E6=AC=A1=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1025643 --- LibreOJ/10194/10194.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LibreOJ/10194/10194.cpp diff --git a/LibreOJ/10194/10194.cpp b/LibreOJ/10194/10194.cpp new file mode 100644 index 00000000..daf5136c --- /dev/null +++ b/LibreOJ/10194/10194.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +long long binpow(long long a, long long b, long long m) { + a %= m; + long long res = 1; + while (b > 0) { + if (b & 1) res = res * a % m; + a = a * a % m; + b >>= 1; + } + return res; +} + +int main() { + long long a, b, m; + cin >> a >> b >> m; + cout << binpow(a, b, m) << endl; + return 0; +}