問題一覧 > 通常問題

No.2194 Brothers' Bargaining

レベル : / AI推定難易度 : 204 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 209
作問者 : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 3140 / 自分の提出
問題文最終更新日: 2023-01-20 21:25:39
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 374 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。