BORDER
InterviewTime limit1sMemory limit1024 MB
Given rectangle sides a and b and strips of length k, find the minimum number of strips to cover the border when each side gets at most one piece from any cut strip.
- Level
Medium4 of 10
- Topics
- Greedy, Math, Implementation
- Solved
- No attempts yet
Problem
Each of the four sides of a rectangular sheet of paper with length centimeters and width centimeters must be covered with strips of glossy paper to form a border. You have enough strips, and each strip has length centimeters. A strip may be used whole or cut into several pieces, as long as the length of every piece is an integer.
At most one piece of a cut strip may be glued onto each side of the sheet.
Write a program border that finds the minimum number of strips needed to cover the sheet.
Input
The first line of standard input contains three integers , , and , separated by a single space. is the length of the rectangular sheet, is its width, and is the length of one strip.
Output
On a single line of standard output, print one integer: the minimum number of strips needed to form the border.