Company: Intuit

Difficulty: medium

Problem Statement

Custom Fence Panels You need to cover a fence of total length `N` using panels. There are two standard panel types available in unlimited supply: a panel of length `a`, costing `p`; a panel of length `b`, costing `q`. You may also order at most one custom panel. A custom panel may have any positive integer length and costs a fixed `F`, regardless of its length. Panels must be laid end-to-end. Their lengths must add up to exactly `N`. Output the minimum total cost. Input Read six positive integers `N a b p q F`. Output Print one integer: the minimum cost. Notes All lengths and costs are positive integers. Standard panels may be used any number of times. The custom panel may be used zero or one time. A custom panel of length `N` is allowed, so a solution always exists. Use 64-bit integer arithmetic for products and the answer.

More Intuit OA questionsInterview experiences