Explain(how do I understand) what the dynamic programming task is asking (uva 166)

312 Views Asked by At

uva 166 - dp problem here

Thus if we need to pay 55c, and we do not hold a 50c coin, we could pay this as 2*20c + 10c + 5c to make a total of 4 coins. If we tender $1 we will receive 45c in change which also involves 4 coins, but if we tender $1.05 ($1 + 5c), we get 50c change and the total number of coins that changes hands is only 3.

I m not asking for solution , I don't get what example is saying:

so, we need to pay 55c , coins = {5,10,20} , 55c = 2*2 + 1*10 + 1*5 - 4 coins.

But what is next ? "if we tender 1$ we will receive 45c? what does it mean ? 1 - 45 = 55 ? yes , thats obvious , but the question is only asking how to change 55C?

and the last is 1.05? but for 1.05 case - they dont' tell what coins are available! Totally confusing

can someone give a bit more detail? i dont' understand the question and the example!

1

There are 1 best solutions below

0
On

It's not asking how to change 55c it's asking how to give 55c to someone else such that the number of coins that change hands is minimized.

i.e. minimize the number of coins you give them, plus the number of coins they must give you as change.