Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Renato Bala.
Sum of Borders
This exercise is asking to find the sum
of the borders of a matrix. In
every level sum of borders of one inner
rectangle is calculated.
Question:
Write a program
that gets as an input a matrix
with dimension n&m and finds the sums of the
outter border and each inner border.
Input specification:
You will be given n and m (1 ≤ (n,m) ≤ 100)
that are the
dimensions of the matrix and n*m integers.
Output specification
Show the sums of each border seperated
from each other by a space.
Sample Input I
5 5
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
|
Sample Input II
3 4
1 2 3 4
5 6 7 8
9 10 11 12
|
Sample Output I
16 8 1
|
Sample Output II
65 13
|
Для отправки решений необходимо выполнить вход.
|