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

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


51117 - The Most Crowded

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

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

• 51094 - Passing the course
• 51130 - Permutation of Everything
• 51069 - Last Digit of a Fibonacci Nu...
• 51073 - Campus Tours for High Sch...
• 51148 - Circles
• 51123 - Mr. Li Criteria
• 51124 - Easy Tiae words
• 51145 - Graduation Exam
• 51117 - The Most Crowded
• 51146 - Popular Baby Names
• 51131 - Running After a Thief
• 51143 - Departments Competition
• 50994 - The Most Crowded Station
• 51118 - Place 7 to the 5th position
• 51132 - Problem Solving Competition
• 51121 - Complexity power of a nu...
• 51119 - Evaluating Prefix expressions

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

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

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

The Most Crowded

You are given a 2D matrix where 0 and negative numbers represent the sea; any other number represent the land. Adjacent land represents the islands. The positive numbers are the number of people living on that section of the island.

Question: Write a program that defines the number of people living on the most crowded island.Note: Two land pieces may be adjacent if they both contain a positive number and share one common border on their four sides (right, left, up and down).

Input specification: You will be given two numbers (n and m) size of the island. Then each of the following n lines contains m integers where the numbers are between -9999 and +9999 and 1 ≤ (n and m) ≤ 100. And there is at least one positive number.

Output specification: Show one integer.

Sample Input Sample Output
4 4
1 -40 11 17
-3 -12 -32 4
-28 -22 -26 -11
8 10 -37 -36
32

Explanation: There are three islands. And, the most crowded island contains (11+17+4) 32 people.



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

www.contester.ru