2 shunfurh shunfurh 于 2017.09.06 00:12 提问

Matrix

Given an n*n matrix A, whose entries Ai,j are integer numbers ( 0 <= i < n, 0 <= j < n ). An operation SHIFT at row i ( 0 <= i < n ) will move the integers in the row one position right, and the rightmost integer will wrap around to the leftmost column.

You can do the SHIFT operation at arbitrary row, and as many times as you like. Your task is to minimize

Input

The input consists of several test cases. The first line of each test case contains an integer n. Each of the following n lines contains n integers, indicating the matrix A. The input is terminated by a single line with an integer -1. You may assume that 1 <= n <= 7 and |Ai,j| < 104.

Output

For each test case, print a line containing the minimum value of the maximum of column sums.

Sample Input

2
4 6
3 7
3
1 2 3
4 5 6
7 8 9
-1

Sample Output

11
15

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.20 08:51
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
matrix calculus
matrix calculus matrix calculus matrix calculus
Android画图之Matrix剖析
Android画图之Matrix剖析Android画图之Matrix剖析Android画图之Matrix剖析Android画图之Matrix剖析Android画图之Matrix剖析Android画图之Matrix剖析Android画图之Matrix剖析
Matrix Algebra Useful for Statistics,2ed,2017 ed
Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed Matrix Algebra Useful for Statistics,2ed
C++ 矩阵简单的计算器
C++课程设计 + Matrix(int l:int, w:int, n:int*) + Matrix() + Matrix(jz :Matrix &) + setnum(l :int, w :int) :void + operator+(const jz: Matrix &): Matrix + operator-(const jz:Matrix &):Matrix + operator*(const jz :Matrix &): Matrix + zhuanzhi():Matrix + show():void + ~Matrix() <<static>> +getflag():int void getmn(int &m,int &n)
步入Matrix函数 步入Matrix函数 步入Matrix函数
步入Matrix函数 步入Matrix函数 步入Matrix函数
Matrix Calculation
Matrix Calculation Matrix Calculation
The Matrix Cookbook(译)
The Matrix Cookbook(译)The Matrix Cookbook译 1基础 1迹Trace 2行列式Determinant 3特例22矩阵 2导数Derivatives1基础∗∗∗A−1表示A的逆矩阵∗∗∗∗;AT表示A的转置;AH表示Hermitian矩阵(A的共轭转置矩阵A∗==A)∗∗∗(AB)−1=B−1A−1(ABC...)−1=...C−1B−1A−1(AT)−1=(A
Relative Orientation 与fundamental essential matrix
由于《Hartley, Zisserman ...》书太厚,啃不动。所以最近回头看youtube上的德国鬼子视频, 补习机器视觉最基础的知识。所以本次博文,没有算法,没有代码,纯粹的定义和识记。 老外视频课程地址:https://www.youtube.com/playlist?list=PLgnQpQtFTOGRsi5vzy9PiQpNWHjq-bKN1  本次总结涵盖视频:Photogramm
python matrix operation
NumPy是一个关于矩阵运算的库,熟悉Matlab的都应该清楚,这个库就是让Python能够进行矩阵话的操作,而不用去写循环操作。 下面对numpy中的操作进行总结。 numpy包含两种基本的数据类型:数组和矩阵。 数组(Arrays) >>> from numpy import * >>> a1=array([1,1,1]) #定义一个数组 >>> a2=array([2,2,2
Android Matrix 超级详解
以下转自:    http://www.gcssloop.com/customview/Matrix_Method    http://www.gcssloop.com/customview/Matrix_Basic这应该是目前最详细的一篇讲解Matrix的中文文章了,在上一篇文章Matrix原理中,我们对Matrix做了一个简单的了解,偏向理论,在本文中则会详细的讲解Matrix的具体用法,以及...