HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC17 Prep Contest > problem:


3. 51097 - Sum of Borders

IMPC17 Prep Contest

Start: Apr.22.2017 at 02:00:00 PM
Finish: Apr.22.2017 at 07:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1. 51099 - Mr. Monk
• 2. 51098 - Rotate a matrix
• 3. 51097 - Sum of Borders
• 4. 51100 - Minimum time to exit buil...
• 5. 50621 - Postal Figures

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