パナソニックプログラミングコンテスト(AtCoder Beginner Contest 195)
翻译中…
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.
翻译中…
样例
Input #1
100 200 2
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.
Input #2
120 150 2
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.
Input #3
300 333 1
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.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。