CF2203A.Towers of Boxes

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Towers of Boxes

Monocarp has nn identical boxes. The weight of each box is mm, and the durability of each box is dd.

To save space, Monocarp wants to build several "towers" of boxes by stacking them on top of each other. Each tower will consist of a positive (greater than 00) integer number of boxes stacked on top of each other. To ensure that no box breaks, the following condition must be met:

  • for each box, the total weight of all boxes above it must not exceed the durability of that box.

Help Monocarp calculate the minimum number of towers he can achieve, given that each of the nn boxes must be used.

Input

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases.

Each test case consists of a single line containing three integers n,m,dn, m, d (1n,m,d501 \le n, m, d \le 50).

Output

For each test case, print one integer — the minimum number of towers.

Note

In the first example, it is possible to build three towers consisting of 33, 22, and 33 boxes, respectively.

In the second example, all boxes are durable enough to build one tower of 88 boxes.

In the third example, the weight of the box exceeds its durability, so they cannot be stacked on top of each other. As a result, 55 separate towers will have to be built.

Samples

3
8 10 20
8 1 20
5 3 2
3
1
5

在线编程 IDE

建议全屏模式获得最佳体验