diff --git a/Easy/Day10/Solution.cpp b/Easy/Day10/Solution.cpp index 5079c42..aef5d4f 100644 --- a/Easy/Day10/Solution.cpp +++ b/Easy/Day10/Solution.cpp @@ -1 +1,27 @@ // Write Your Code here +#include +using namespace std; +long long BinExpo(long long a, long long b, long long m) +{ + // basse case + if (b == 0) + return 1; + // recursive case + long long res = BinExpo(a, b / 2, m); + if (b & 1) // if b is odd + { + return ((a * (res % m)) % m * (res % m)) % m; + } + else + { + return (res * res) % m; + } +} +int main() +{ + + long long a, b, m; + cin >> a >> b >> m; + + cout << BinExpo(a, b, m) << endl; +} \ No newline at end of file diff --git a/Easy/Day10/Solution.exe b/Easy/Day10/Solution.exe new file mode 100644 index 0000000..2327246 Binary files /dev/null and b/Easy/Day10/Solution.exe differ diff --git a/Easy/Day8/Solution.cpp b/Easy/Day8/Solution.cpp index 9020e8d..b55091c 100644 --- a/Easy/Day8/Solution.cpp +++ b/Easy/Day8/Solution.cpp @@ -1,30 +1 @@ -#include -using namespace std; -long long BinExpo(long long a, long long b, long long m) -{ - // basse case - if (b == 0) - return 1; - // recursive case - long long res = BinExpo(a, b / 2, m); - if (b & 1) // if b is odd - { - return ((a * (res % m)) % m * (res % m)) % m; - } - else - { - return (res * res) % m; - } -} -int main() -{ - long long m = 1e9 + 7; - int t; - cin >> t; - while (t--) - { - long long a, b; - cin >> a >> b; - cout << BinExpo(a, b, m) << endl; - } -} \ No newline at end of file +// Write your code here