Do Not Touch Anything
InterviewTime limit1sMemory limit32 MB
Given an R by C grid and an N by N square, find the fewest squares needed to cover the whole grid, allowing overhang and overlap.
Problem
The seats in the contest hall form a rectangle with rows and columns. Before the contest starts the participants must not touch anything, so the host keeps warning them.
The host has now lost his voice and cannot shout any more. The organizers decided to install cameras to watch the participants instead. One camera records the seats in a rectangular area of rows and columns. A camera must be placed in the same orientation as the seating grid, and its area may stick out past the seats or overlap the area of another camera.
Find the minimum number of cameras needed so that every seat is recorded by at least one of them.
Input
The first line contains the seat grid height , the width , and the range that one camera records, separated by spaces. ()
Output
Print the minimum number of cameras needed to record every seat, on one line.