HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51097 - Sum of Borders

Guest
• Review clarifications (1)

Section problems

• 50326 - Matrix Operations
• 50395 - Page "Like" Averages
• 50410 - Zero Padding
• 50329 - Draw Matrix-1
• 50337 - Exam Averages
• 50334 - What is the class average?
• 50383 - Noisy Mornings
• 51129 - Hexagon
• 51097 - Sum of Borders
• 50419 - The longest bitonic sequence
• 50420 - Teachers Sightseeing
• 50344 - Profit or Loss
• 50431 - Sultan's Game
• 50445 - Cryptography
• 51246 - Swap largest word, reverse ...
• 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