The Prime Cells
Practice
3.5 (47 votes)
Basic programming
Easy
Implementation
Problem
62% Success 11662 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code
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.
Submissions
Please login to view your submissions
Similar Problems
Points:20
178 votes
Tags:
GeometryHiringApprovedEasy
Points:20
32 votes
Tags:
ApprovedBasic ProgrammingEasyOpen
Points:20
13 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Editorial