100 atcoder#ABC195B. [ABC195B] Many Oranges
[ABC195B] Many Oranges
Score : points
Problem Statement
We have many oranges. It is known that every orange weighs between and grams, inclusive. (An orange can have a non-integer weight.)
We chose some of those oranges, and their total weight was exactly kilograms.
Find the minimum and maximum possible numbers of oranges chosen. If no set of oranges can weigh exactly kilograms in total, report that fact.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum and maximum possible numbers of oranges chosen, in this order, with space in between. If there is no number of oranges that can have the specified total weight, print UNSATISFIABLE
instead.
100 200 2
10 20
Here, one range weighs between and grams (inclusive).
- If we choose -gram oranges, their total weight will be exactly kilograms.
- If we choose -gram oranges, their total weight will be exactly kilograms.
With less than oranges or more than oranges, the total weight will never be exactly kilograms, so the minimum and maximum possible numbers of oranges chosen are and , respectively.
120 150 2
14 16
Here, one range weighs between and grams (inclusive).
- If we choose -gram oranges and -gram oranges, for example, their total weight will be exactly kilograms.
- If we choose -gram oranges and -gram oranges, for example, their total weight will be exactly kilograms.
With less than oranges or more than oranges, the total weight will never be exactly kilograms, so the minimum and maximum possible numbers of oranges chosen are and , respectively.
300 333 1
UNSATISFIABLE
Here, one range weighs between and grams (inclusive).
No set of oranges of this kind can weigh exactly kilograms in total.