2014
03-16

Matrix Puzzle

As you know, math is quite incredible.For example,if you want to know all x that not only satisfy the expression A^x = B ( mod C) where A,B and C are given and C is a prime number, but also smaller than C, you could use the following algorithm
(http://en.wikipedia.org/wiki/Baby-step_giant-step).
Now your task is quite simple. You are given A,B, here A and B are matrixes( n X n).You are expected to solve the following expression.
mod 1000000007

There are no more than 20 cases.
For each case,there are two integers n,L in the first line indicating the size of the matrixes , the value of L. (Here 1<= n <= 50, 1<= L <= 10^11)
Then follows 2n lines.
For the first n lines, indicating the matrix A.
For the next n lines, indicating the matrix B.
All the numbers in the matrix are between 0 and 10^9

There are no more than 20 cases.
For each case,there are two integers n,L in the first line indicating the size of the matrixes , the value of L. (Here 1<= n <= 50, 1<= L <= 10^11)
Then follows 2n lines.
For the first n lines, indicating the matrix A.
For the next n lines, indicating the matrix B.
All the numbers in the matrix are between 0 and 10^9

1 6
2
2

1 4
2
1

2 3
1 2
2 1
5 4
4 5

Case 1: Yes
Case 2: No
Case 3: Yes

1. 站长，你好！
你创办的的网站非常好，为我们学习算法练习编程提供了一个很好的平台，我想给你提个小建议，就是要能把每道题目的难度标出来就好了，这样我们学习起来会有一个循序渐进的过程！