omg's blog

By omg, 4 years ago, In English

Problem A

You have to realize that when the price of one donut is greater than or equal to price of the box of donuts the first x will be -1. If it's not it will be 1. Then for the second x you have to realize that when the price of the box of donuts divided by the number of donuts in the box is less than price of one donut the second x will be 1000000000. If it's not it will be -1.

Here is the solution:

Problem B

Problem C

Problem D

  • Vote: I like it
  • -20
  • Vote: I do not like it

»
4 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

For problem A consider the test case 1, 10^9 -1, 10^9 -2. The program outputs 10^9 for the second shop when it costs 2*(10^9 -2) for the second shop > 10^9 for the first. If you output x = b it is the most optimal for shop 2.