You are given a grid of size \(n \times n\) filled with numbers in each of its cells. Now you need to count total cells in the grid such that the sum of the numbers on its top , left , right and bottom cells is a prime number. In case there is no cell in a particular direction assume the number to be as 0.
Input
First line contains a number n as input denoting size of the grid. Next n lines contain n numbers each denoting value of the elements of the grid in each row.
Output
In the output you have to give the count of total cells as described above.
Constraints
\(2 \le n \le 100 \)
\(1 \le g[i][j] \le 100 \) where \(g[i][j]\) is the value in the grid at \(i^{th}\) row and \(j^{th}\) column.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial