-->
当前位置:首页 > 题库

PROGRAMMING:Calculate the sum of matrix edge elements

Luz5年前 (2021-05-10)题库438
###Task description
Input an integer matrix to calculate the sum of the elements at the edge of the matrix. The elements at the edge of a matrix are the elements of the first row and the last row, and the elements of the first column and the last column.
###Input format:
The first row is the number of rows m and the number of columns n of the matrix (m < 100, n < 100), which are separated by a space.
In the next M rows of data, each row contains n integers separated by a space.
###Output format:
Output the edge elements and corresponding matrix
###Input example:
```in
3 3
3 4 1
3 7 1
2 0 1
```
###Output example:
```out
fifteen
```
###Title Source
This topic is selected from openjudge website http://noi.openjudge.cn/ch0108/03/







answer:If there is no answer, please comment