编程介的小学生 2019-09-27 19:32 采纳率: 20.5%
浏览 98

求解矩阵,Matrix Puzzle

Problem Description
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

Input
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

Output
Output a single line with “Case #idx: ”,here idx is the case number start from 1. Then output if there is only one valid solution (the solution must no larger than L and larger than 0).
If there is only one valid solution ,then just output “Yes”, otherwise output “No”.
We assure that the ABS(|A|) (determinant’s abosolute value)is always larger than one after the mod operation in all the cases.

Sample Input
1 6
2
2

1 4
2
1

2 3
1 2
2 1
5 4
4 5

Sample Output
Case 1: Yes
Case 2: No
Case 3: Yes

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!
    • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?