Codeforces Round 926 (Div. 2)
C
Sasha and the Casino
Codeforces
1400
原题
← BD →
翻译中…

Sasha decided to give his girlfriend the best handbag, but unfortunately for Sasha, it is very expensive. Therefore, Sasha wants to earn it. After looking at earning tips on the internet, he decided to go to the casino.

翻译中…

Sasha knows that the casino operates under the following rules. If Sasha places a bet of $y$ coins (where $y$ is a positive integer), then in case of winning, he will receive $y \cdot k$ coins (i.e., his number of coins will increase by $y \cdot (k - 1)$). And in case of losing, he will lose the entire bet amount (i.e., his number of coins will decrease by $y$).

翻译中…

Note that the bet amount must always be a positive ($ \gt 0$) integer and cannot exceed Sasha's current number of coins.

翻译中…

Sasha also knows that there is a promotion at the casino: he cannot lose more than $x$ times in a row.

翻译中…

Initially, Sasha has $a$ coins. He wonders whether he can place bets such that he is guaranteed to win any number of coins. In other words, is it true that for any integer $n$, Sasha can make bets so that for any outcome that does not contradict the rules described above, at some moment of time he will have at least $n$ coins.

翻译中…

Input

翻译中…

Each test consists of multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases. The description of the test cases follows.

翻译中…

The single line of each test case contains three integers $k, x$ and $a$ ($2 \leq k \leq 30$, $1 \leq x \leq 100$, $1 \leq a \leq 10^9$) — the number of times the bet is increased in case of a win, the maximum number of consecutive losses, and the initial number of coins Sasha has.

翻译中…

Output

翻译中…

For each test case, output "YES" (without quotes) if Sasha can achieve it and "NO" (without quotes) otherwise.

翻译中…

You can output "YES" and "NO" in any case (for example, the strings "yEs", "yes" and "Yes" will be recognized as a positive answer).

翻译中…

Note

翻译中…

In the first test case, Sasha can proceed as follows:

翻译中…
  • If Sasha places a bet for the first time or if he won the previous bet, then he places $1$ coin.
  • If Sasha lost the previous bet, then he places $2$ coins.
翻译中…

Note that Sasha cannot lose more than once in a row.

翻译中…

It can be proven that with this strategy, Sasha can obtain as many coins as he wants.

翻译中…

In the second test case, Sasha can only place $1$ coin for the first time. But in case of a loss, he will not be able to place any more bets, so he will not be able to guarantee having as many coins as he wants.

翻译中…

样例

Input #1
9
2 1 7
2 1 1
2 3 15
3 3 6
4 4 5
5 4 7
4 88 1000000000
25 69 231
13 97 18806
Output #1
YES
NO
YES
NO
NO
YES
NO
NO
NO
InputCopy OutputCopy
题目信息
题号
1929C
时间限制
2 s
内存限制
256 MB
标签
二分
暴力
构造
博弈论
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。