101951: [AtCoder]ABC195 B - Many Oranges

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $200$ points

Problem Statement

We have many oranges. It is known that every orange weighs between $A$ and $B$ grams, inclusive. (An orange can have a non-integer weight.)

We chose some of those oranges, and their total weight was exactly $W$ kilograms.

Find the minimum and maximum possible numbers of oranges chosen. If no set of oranges can weigh exactly $W$ kilograms in total, report that fact.

Constraints

  • $1 \leq A \leq B \leq 1000$
  • $1 \leq W \leq 1000$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$A$ $B$ $W$

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.


Sample Input 1

100 200 2

Sample Output 1

10 20

Here, one range weighs between $100$ and $200$ grams (inclusive).

  • If we choose $10$ $200$-gram oranges, their total weight will be exactly $2$ kilograms.
  • If we choose $20$ $100$-gram oranges, their total weight will be exactly $2$ kilograms.

With less than $10$ oranges or more than $20$ oranges, the total weight will never be exactly $2$ kilograms, so the minimum and maximum possible numbers of oranges chosen are $10$ and $20$, respectively.


Sample Input 2

120 150 2

Sample Output 2

14 16

Here, one range weighs between $120$ and $150$ grams (inclusive).

  • If we choose $10$ $140$-gram oranges and $4$ $150$-gram oranges, for example, their total weight will be exactly $2$ kilograms.
  • If we choose $8$ $120$-gram oranges and $8$ $130$-gram oranges, for example, their total weight will be exactly $2$ kilograms.

With less than $14$ oranges or more than $16$ oranges, the total weight will never be exactly $2$ kilograms, so the minimum and maximum possible numbers of oranges chosen are $14$ and $16$, respectively.


Sample Input 3

300 333 1

Sample Output 3

UNSATISFIABLE

Here, one range weighs between $300$ and $333$ grams (inclusive).

No set of oranges of this kind can weigh exactly $1$ kilograms in total.

Input

题意翻译

有若干个橘子,重量在 $a$ **克**以上 $b$ **克**以下(含 $a$ 克和 $b$ 克)。请问它们的重量之和能否正好为 $w$ **公斤**?如果可以,输出橘子个数的最小值和最大值;否则输出 UNSATISFIABLE 。 注意,每个橘子的重量都可能**不是整数**。

加入题单

算法标签: