diff --git a/src/main/cpp/algorithms/math/Binary_Exponentiation.cpp b/src/main/cpp/algorithms/math/Binary_Exponentiation.cpp new file mode 100644 index 0000000..bb1d3c1 --- /dev/null +++ b/src/main/cpp/algorithms/math/Binary_Exponentiation.cpp @@ -0,0 +1,29 @@ +#include +#define ll long long + +using namespace std; + +ll power(ll a,ll n) +{ + ll res=1; + + while(n) + { + if(n&1) + { + res=res*a; + n--; + } + a*=a; + n/=2; + } + return res; +} + +int main() +{ + ll a,n; + cin>>a>>n; + cout< +#define ll long long +#define MOD 1000000007 +using namespace std; +#define N 51 +ll mat[51][51],I[51][51]; +void show(ll A[][N],int dim) +{ + for(int i=0;i>t; + while(t--) + { + int m,n; + cin>>m>>n; + for(int i=0;i>mat[i][j]; + + } + power(mat,m,n); + + + } + return 0; + +}