HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51097 - Sum of Borders

Guest
• Review clarifications (1)

Section problems

• 51165 Question 1
• 51171 Question 3
• 51175 Question 2
• 51093 - rgb2gray
• 51092 - Even and Odd
• 51095 - Normal and Trace
• 50382 - Parkside's Other Triangle
• 50383 - Noisy Mornings
• 51097 - Sum of Borders
• 51129 - Hexagon
• 51246 - Swap largest word, reverse ...
• 50431 - Sultan's Game
• 50420 - Teachers Sightseeing
• 50977 - Gaussian Elimination
• 50395 - Page "Like" Averages
• 50516 - Lines
• 50446 - Snake

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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


Для отправки решений необходимо выполнить вход.

www.contester.ru