Clarity in question statement

according to the sample case
for n = 12, maximum gold = 13
according to my understanding this can be done only if 12 is exchanged for 3 coins of values 6,4,3

my question is that if n is not divisible by 2,3 and 4, what happens in that case? Can it still be exchanged for copper coins? Or does it have to be sold for gold? If it can be exchanged for copper then what is the value of the copper coins?
like for eg n = 6, what happens in this case? since 6 is not divisble by 4 can i just get copper coins of value 2 and 3?

Iā€™m getting run-error in one test case and MLE in other, my code: https://ide.codingblocks.com/s/285974

@Ishitagambhir your code is correct just use map instead of vector as 1e9 is too large for vector or array


(corrected)

1 Like