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

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


50990 - Two Neighbors

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

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

• 50345 - Orders
• 51127 - Maze solver
• 50822 - Linked List
• 51126 - Dr. Fllanxha
• 50529 - Row to Table
• 50499 - Table to Row
• 50823 - Secret Number
• 50853 - Parking Place
• 50990 - Two Neighbors
• 50496 - Falling Bricks
• 51021 - Number of Nodes
• 50829 - Decode an Image
• 51044 - Number of Trees
• 50876 - He is my cousin
• 51098 - Rotate a matrix
• 50838 - Balanced Numbers
• 50851 - Repeated Numbers

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

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

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

Two Neighbors

In a 2D matrix, you are given housing of n people where 1 represents the houses and 0 represents the empty places.

Question: Show the number of houses which have at least two neighbors.

Input specification: First, you will be given an integer: the size of 2D matrix (n). The following n lines contain n integers (one or zero) where 1 ≤ n ≤ 100.

Output specification: Show one integer.

Sample Input
5
0 1 0 0 1
1 1 0 0 1
0 0 1 0 1
1 0 0 1 0
1 1 0 0 1
Sample Output
3



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

www.contester.ru