Math, asked by Disai4904, 1 year ago

Matrix Power

Alice is learning basic discrete mathematics. In between of her leanings one day her tutor has given the following problem.

"A^M = A*A*A ... M times."

Let K be the matrix with N*N size and Aij represent the element at ith row and jth column. Matrix exponent product is defined as . As the result can be long mod the result with 1000000007.

As the Alice is newbie to maths, help her to solve the problem.

Input Format:

First line starts with N, and then N lines follow each will contain N spaced integers Aij.
After N lines next line contains M.

Output Format:

Print the matrix exponent product.

Constraints:

1<=N<=4000

1<=Aij<=10^7

1<=M<=10^9; Matrix Power; Alice is learning basic discrete mathematics. In between of her leanings one day her tutor has given the following problem.; "A^M = A*A*A ... M times."; Let K be the matrix with N*N size and Aij represent the element at ith row and jth column. Matrix exponent product is defined as . As the result can be long mod the result with 1000000007.; As the Alice is newbie to maths, help her to solve the problem.; Input Format:; First line starts with N, and then N lines follow each will contain N spaced integers Aij.; After N lines next line contains M.; Output Format:; Print the matrix exponent product.; Constraints:; 1<=N<=4000; 1<=Aij<=10^7; 1<=M<=10^9

Answers

Answered by mohsinalam
1
ok.................
please mark this as brainliest answer and thank me and follow me
Similar questions