From 803bd3a891f16d8e01153e05e1e2a21955892d80 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sat, 2 Oct 2021 15:28:30 +0800 Subject: [PATCH] =?UTF-8?q?H1032.=20=E3=80=90=E6=A8=A1=E6=9D=BF=E3=80=91?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E5=B9=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/record/61580a1c2a2aefdda01dcf8a --- Hydro/H1032/H1032.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Hydro/H1032/H1032.cpp diff --git a/Hydro/H1032/H1032.cpp b/Hydro/H1032/H1032.cpp new file mode 100644 index 00000000..d7c4e704 --- /dev/null +++ b/Hydro/H1032/H1032.cpp @@ -0,0 +1,21 @@ +#include + +using namespace std; + +long long binpow(long long a, long long b, long long p) { + long long res = 1; + a %= p; + while (b) { + if (b & 1) res = res * a % p; + a = a * a % p; + b >>= 1; + } + return res; +} + +int main() { + long long a, b, p; + cin >> a >> b >> p; + cout << binpow(a, b, p) << endl; + return 0; +}