#P215. 【例36.1】 计算矩阵边缘元素之和
【例36.1】 计算矩阵边缘元素之和
Description
Input an integer matrix and calculate the sum of elements located on the edges of the matrix. The edge elements are those in the first and last rows, as well as the first and last columns.
Input Format
The first line contains two integers m and n (m < 100, n < 100), representing the number of rows and columns of the matrix, separated by a space.
The next m lines each contain n integers (ranging from 0 to 9), separated by spaces.
Output Format
Output the sum of the edge elements of the matrix.
Sample
3 3
3 4 1
3 7 1
2 0 115