C. 计算矩阵边缘元素之和

    Type: Default 1000ms 256MiB

计算矩阵边缘元素之和

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

输入一个整数矩阵,计算位于矩阵边缘的元素之和。

所谓矩阵边缘的元素,就是第一行和最后一行的元素以及第一列和最后一列的元素。

输入格式

11 行包含两个整数,分别为行数 mm 和列数 nn,两个整数之间空格隔开。

22 行开始有 mm 行数据,每行包含 nn 个整数,整数之间空格隔开。

输出格式

对应矩阵的边缘元素和。

输入输出样例 #1

输入 #1

3 3
3 4 1
3 7 1
2 0 1

输出 #1

15

说明/提示

1m,n1001 \le m,n \le 100。保证答案在 int 范围内。

龙凤苑中学3.14

Not Attended
Status
Done
Rule
IOI
Problem
3
Start at
2025-3-14 17:00
End at
2025-3-14 19:00
Duration
2 hour(s)
Host
Partic.
27