HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN112 Questions 2016 > problem:


15-FE-7. 50990 - Two Neighbors

CEN112 Questions 2016

Start: Mar.30.2016 at 03:10:22 PM
Finish: Apr.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 15-FE-1. 50992 - Top K Obese Classes
• 15-FE-2. 50993 - Products in store
• 15-FE-3. 50994 - The Most Crowded...
• 15-FE-4. 50995 - Group Average
• 15-FE-6. 50989 - Rectangles and Points
• 15-FE-7. 50990 - Two Neighbors
• 15-FE-8. 50991 - Intersecting Circles
• 15-HW-2. 50932 - Shifting rows and...
• 15-HW-3. 50933 - Sum of the Bigges...
• 15-HW-4. 50934 - Selling Cars
• 15-HW-5. 50935 - Max Discount
• 15-MdtE-1. 50915 - Trip to Korca
• 15-MdtE-2. 50916 - Ascending Num...
• 15-MdtE-3. 50913 - Manhattan Distance

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 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