ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


51008 - Sum of Regional Maxes

Гость
• Вопросы к жюри (1)

Задачи раздела

• 51011 - Decoding the Path
• 51088 - Number of letters
• 51172 - The biggest Minute
• 51125 - Filling an Array 3
• 51085 - xyx Divisible by k
• 51087 - Are they the same?
• 51091 - Guess the number - 1
• 51015 - Student Scholarships
• 51008 - Sum of Regional Maxes
• 51020 - Number of nodes removed
• 51141 - Most valuable stock items
• 51014 - Nine Men's Morris game
• 51019 - Finding the hidden message
• 51100 - Minimum time to exit building
• 51089 - Multiply a row and add it to ...
• 50525 - Ordering Pizza
• 50531 - File Decryption

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Sum of Regional Maxes

You have data in a table (2D matrix r-by-c) and you are asked to calculate sum of regional maxes. 2D array will be divided into square regions with the given dimension (k) starting from the upper left corner. The max of every region is to be determined and the sum of maxes will be calculated. Search max, only within the given matrix (r-by-c).

Question: Write a program which reads information and calculates the sum of regional maxes.

Input specification: You will be given three integers in the beginning:

  • The number of rows (r) and columns (c): two positive integers not greater than 200,
  • The size of square regions (k)
where 1 < k < (r and c) ≤ 200. Then, each of the following r lines contains c integers which are between -2e4 and +2e4.

Output specification: Show one integer.

Sample Input
5 6 3
0 8 1 1 10 6
6 8 7 0 3 9
0 7 6 8 6 5
4 0 2 7 2 0
4 4 5 7 5 1
Sample Output
30

Explanation: Max of the first region is 8. And sum of regional maxes is 8 + 10 + 5 + 7 = 30.



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

www.contester.ru