No.2194 Brothers' Bargaining
タグ : / 解いたユーザー数 209
作問者 :
nmnmnmnmnmnmnm
Problem Statement
There were two brothers, an older brother and a younger brother.
A positive integer $N$ is given.
・The older brother multiplies the given integer by $A$. He then passes the integer to the younger brother.
・The younger brother subtracts $B$ from the received integer if the result of subtracting $B$ would not be 0 or less; if it would be 0 or less, he does nothing.
The integer the younger brother finally holds was the positive integer $C$.
Given $A$, $B$, and $C$, enumerate all possible initial values of $N$ in ascending order.
If there is no possible $N$, output -1.
Input
$A$ $B$ $C$
$A$, $B$, and $C$ are positive integers. $1 \le A,B,C \le 100000=10^5$.
Output
Output the answer. If there are multiple answers, output them on multiple lines. Each line must end with a newline.
Sample
Sample 1
Input
1 1 1
Output
1 2
When $N$=1, the older brother multiplies it by 1 and passes it to the younger brother. Subtracting 1 would give 0, so the younger brother does nothing. Thus $C$=1.
When $N$=2, the older brother multiplies it by 1 and passes it to the younger brother. The younger brother subtracts 1 from 2. Thus $C$=1.
These are the only two cases that result in $C$=1.
Sample 2
Input
2 1 1
Output
1
Sample 3
Input
3 1 1
Output
-1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。