Sunday, April 12, 2015

HackerRank::Algorithms::Warmup::Taum and B'day

  We will call the two types as "cheap" and "expensive", the cheap one obviously is the one which is cheaper than the other. If the prices are equal than there is no difference whether we name the first one as the "cheap" one or the second one. We need to buy all the required gifts off the cheap type. Then, if buying another cheap gift and converting it to the other type is still cheaper than the original price of the expensive gift, then we buy all the first with the "cheap" value and convert the necessary amount to the other type, otherwise we buy the expensive ones with their price.



No comments:

Post a Comment