King of Gamers
题号:NC236490
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Little G is going to play n games.

Little G is the king of gamers. If he wants to win, he will definitely win a game. But if he doesn't care about winning or losing, he will lose a game because of his bad luck. Little G has an expected winning rate of . When playing the -th game, if his current winning rate is lower than or equal to , he will be eager to win and win the game easily. Otherwise, he will enjoy the game and lose it.

Given , Little G is wondering how many games he will win.
Note that when playing the first game, the winning rate is regarded as .

It is guaranteed that the answer is either  or .

输入描述:

The input consists of multiple test cases.

The first line consists of a single integer  () - the number of test cases.

In the following  lines, each line consists of three integers  (), denoting a test case.


输出描述:

Print  lines. Print one integer in each line, representing the answer of a test case.
示例1

输入

复制
3
4 3 5
8 7 10
1 1 3

输出

复制
2
5
1

备注:

In the first test case, :
When playing the first game, the winning rate = , so Little G will win the game;
When playing the second game, the winning rate = , so Little G will lose the game;
When playing the third game, the winning rate = , so Little G will win the game;
When playing the fourth game, the winning rate = , so Little G will lose the game.
In total, Little G will win  games, which is the answer of the first test case.