841 - EECS_I2P(I)2015_Chen_Lab4 Scoreboard

Time

2015/10/21 08:30:00 2015/10/21 10:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
10778 inner product

10778 - inner product   

Description

Given a NxN matrix, find the maximum element and record it's position. Calculate the inner product of two vectors which are row-m and column-n respectively, where (m,n) is the position of the maximun element.

For example, the maximun element of the matrix below is 16. So the m-row is [11 16 15 6] and n-colume is [2 13 16 9] . The inner product is 11*2 + 16*13 + 15*16 + 6*9  = 524.

There will be no multiple maximum, so don't worry about that.

Input

The first line is a positive integer N (1<=N<=10), which represent the size of matrix.
For the next N lines, each line contains N integers, specifying the elements of the matrix. All the element are between 1 and 99.

Output

A positive integer, which is the inner product of two vector metnioned in the desription above.

There is no need to print  '\n' at the end .

Sample Input  Download

Sample Output  Download

Tags




Discuss