Created
February 12, 2016 18:57
-
-
Save abdalimran/b048c2d65eb94065a3b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Bismillah hir rahmanir raheem. Thanks to Allah for everything. | |
Coder: Abdullah Al Imran | |
Email: [email protected] */ | |
#include<bits/stdc++.h> | |
using namespace std; | |
//Big Mod | |
int big_mod(int base, int power, int mod) | |
{ | |
if(power==0) | |
return 1; | |
else if(power%2==1) | |
{ | |
int p1 = base % mod; | |
int p2 = (big_mod(base,power-1,mod))%mod; | |
return (p1*p2)%mod; | |
} | |
else if(power%2==0) | |
{ | |
int p1 = (big_mod(base,power/2,mod))%mod; | |
return (p1*p1)%mod; | |
} | |
} | |
int main() | |
{ | |
ios_base::sync_with_stdio(false); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment