Category Archives: SRM Div-2 Level-3

AmountApproximation : TopCoder Problem 4845

[The problem appeared in TopCoder SRM 274 (Div-2, Level-3)]

Problem link:

Problem Statement:
We must pay D dollars. Unfortunately, we only have bills of two denominations: p1 dollars and p2 dollars. So, we want to overpay as little as possible.

You will be given ints D, p1 and p2. Return the minimum number of dollars greater than or equal to D that can be paid with the given bills. Assume that we have an infinite supply of both p1 and p2 dollar bills.
Continue reading