#K49797. Perfect Square Plot Count
Perfect Square Plot Count
Perfect Square Plot Count
Problem Statement: You are given a farm represented as a grid with n rows and m columns. Each cell in the grid represents a plot of land. Your task is to determine how many square sub-grids (subareas) of exactly k plots can be formed. Note that for a square sub-grid to have an area of k, the number k must be a perfect square, i.e., k = s^2 for some integer s. If this condition holds, then the number of possible positions for an s × s square within an n × m grid is given by:
\( (n - s + 1) \times (m - s + 1) \)
If k is not a perfect square, the answer is 0.
inputFormat
Input Format: Input is provided via standard input (stdin). The first and only line contains three space-separated integers: n, m, and k, where n and m denote the dimensions of the grid and k is the area (number of plots) required for the square sub-grid.
outputFormat
Output Format: Output a single integer to standard output (stdout) representing the number of ways to form a perfect square sub-grid (of area k) within the given grid.
## sample5 4 9
6
</p>