atcoder#ABC192F. [ABC192F] Potion
[ABC192F] Potion
Score : points
Problem Statement
There are kinds of materials. Material has a magic power of .
Takahashi, the magician, wants to make a potion by choosing one or more kinds from these materials and mixing them.
At the moment when he makes a potion by mixing kinds of materials, the magic power of the potion is the sum of the materials used. Then, every second, its magic power increases by . Note that the increase of the magic power is a discrete - not continuous - process.
Takahashi will mix materials just once, at time . What is the earliest time he can get a potion with a magic power of exactly ?
Under the constraints, it can be proved that it is possible to make a potion with a magic power of exactly .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the earliest time he can get a potion with a magic power of exactly .
3 9999999999
3 6 8
4999999994
The potion made by mixing Material and Material has a magic power of at time , and it increases by every second, so it will be at time , which is the earliest possible time.
The potion made by mixing all the materials will have a magic power of at time and at time , so it will never be exactly .
1 1000000000000000000
1
999999999999999999