C++编程题 关于矩阵...

问题描述:

C++编程题 关于矩阵...
2470.Matrix Commutative Multiplication
限制条件
时间限制:5 秒,内存限制:256 兆
Given a square matrix of order N.Your task is to check whether AB=BA for all square matrix of the same order N.
输入格式The input begins with the integer t,the number of test cases.Then t test cases follow.
For each test case:In the first line there is an integer N (N
1个回答 分类:综合 2014-12-14

问题解答:

我来补答
给定一个N阶方阵A,你的任务就是检验对所有的N阶方阵B,AB==BA是否成立.
输入格式为:第一行为测试例子的个数t,接着是t个测试例子.
对每一个测试例子,第一行是N就是方阵的阶数,在接下来的N行中,每行有N个整数.所有的整数都不超过1000(就是输入方阵的数据).
输出格式是:如果给定的N阶方阵A,对所有的N阶方阵B,AB==BA成立,输出“YES”,否则输出“NO”.
(题中给出的数据第二个方阵是单位阵,所以成立,就输出“YES”)
(以上是题意,怎么做等人来回答吧)
 
 
展开全文阅读
剩余:2000