From c17b6a9ee0223d0ffee6d2dd29797aeee68c504e Mon Sep 17 00:00:00 2001 From: Mann Mehta <44433995+mann2108@users.noreply.github.com> Date: Sat, 9 May 2020 00:21:24 +0530 Subject: [PATCH] Resolve type errors in math/mod_inverse_by_fermat_theorem.cpp --- math/mod_inverse_by_fermat_theorem.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/math/mod_inverse_by_fermat_theorem.cpp b/math/mod_inverse_by_fermat_theorem.cpp index 3c306e467..5276956f7 100644 --- a/math/mod_inverse_by_fermat_theorem.cpp +++ b/math/mod_inverse_by_fermat_theorem.cpp @@ -23,16 +23,16 @@ * */ - #include - #include +#include +#include - // m is large prime number. - const long long int m = 1000000007; +// m is large prime number. +const int64_t m = 1000000007; // Recursive function to calculate exponent in O(log(n)) using binary exponent. -long long int binExpo(long long int a, long long int b) { +int64_t binExpo(int64_t a, int64_t b) { a %= m; - long long int res = 1; + int64_t res = 1; while (b > 0) { if (b%2) { res = res * a % m; @@ -46,7 +46,7 @@ long long int binExpo(long long int a, long long int b) { int main() { // Take input of a. (A number for which we want to find modular inverse with m) - long long int a; + int64_t a; std::cout << "Give input a for computing ((a^(-1))%(m)) : "; std::cin >> a;