UVA 11149 - Power of Matrix UVA • Sep 1, 2020 Problem PDFSolution:#include #include #include #include using namespace std; #define maxn 44 #define mod 10 int n; struct matrix{ int f[maxn][maxn]; }; matrix sum(matrix a,matrix b) { int i,j; matrix s; for(i=0;i>1; } return s; } matrix work(matrix e,int k) { matrix s,a,b; if(k==1) return e; a=work(e,k/2); s=sum(a,mul(a,pows(e,k/2))); if(k&1) s=sum(s,pows(e,k)); return s; } int main() { int k; while(cin>>n>>k) { if(n==0) break; int i,j,a; matrix e; for(i=0;i>a; e.f[i][j]=a%10; } } e=work(e,k); for(i=0;ihttps://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/11149/11149.cpp Tags UVA Competitive Programming Shipu Ahamed Recommended for you UVA UVA 913 - Joana and the Odd Numbers 4 years ago • 1 min read UVA UVA 871 - Counting Cells in a Blob 4 years ago • 3 min read UVA UVA 866 - Intersecting Line Segments 4 years ago • 3 min read