diff options
author | Ta180m | 2020-04-10 17:50:52 -0500 |
---|---|---|
committer | Ta180m | 2020-04-10 17:50:52 -0500 |
commit | b7c7075fe649ea7494920aa94d07fa9a76e2d0cd (patch) | |
tree | fd68e79dfeaf02416c0b05bbe2e624e1f3b92462 /Math | |
parent | 193535b92d35ff6f30ab8e08e435ca2d65bc5cf9 (diff) |
Update numtheory.cpp
Diffstat (limited to 'Math')
-rw-r--r-- | Math/numtheory.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Math/numtheory.cpp b/Math/numtheory.cpp index a950f57..e6dc807 100644 --- a/Math/numtheory.cpp +++ b/Math/numtheory.cpp @@ -1,13 +1,13 @@ constexpr ll MOD = 1e9+7; -int pow(int base, int exp) { +int pw(int base, int exp) { int res = 1; while (exp) { - if (exp & 1) res = ((ll)base * res) % MOD; + if (exp & 1) res = (ll)base * res % MOD; exp >>= 1; - base = ((ll)base * base) % MOD; + base = (ll)base * base % MOD; } return res; } -int inv(int x) { return pow(x, MOD - 2); } +int inv(int x) { return pw(x, MOD - 2); } |