Thursday, December 18, 2014

ACM 1796. Amusement Park / Парк аттракционов

   First of all, if buying X tickets we do not have enough money then for buying more than X tickets we won't have enough money too. Secondly, If after buying X tickets , we can buy some more tickets with the remaining money, then after buying some number of tickets less than X we will still have enough money to buy more tickets. All of these means that the answer is an interval of numbers. Obviously the upper bound is the total number of money divided on the cost of the ticket. If we had one note missing than it wouldn't be enough so if we consider the possibility of all the possible number of tickets after considering each of the 6 notes lost and take the maximum of those numbers we will the lower bound of our interval.


       FULL SOURCE CODE

No comments:

Post a Comment