CF2203A.Towers of Boxes

入门

通过率:0%

时间限制:2.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

Monocarp 有 nn 个完全相同的箱子。每个箱子的重量为 mm,耐压强度(即能承受的最大上方总重量)为 dd。

为了节省空间,Monocarp 希望通过将箱子堆叠起来,构建若干个“塔”。每个塔由若干个(正整数个,即大于 00)箱子垂直堆叠而成。为确保没有箱子被压坏,必须满足以下条件:

  • 对于每个箱子,其上方所有箱子的总重量不得超过该箱子的耐压强度 dd。

请帮助 Monocarp 计算在必须使用全部 nn 个箱子的前提下,所能达到的最少塔的数量。

输入格式

The first line contains a single integer tt (1≤t≤1041 \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 (1≤n,m,d≤501 \le n, m, d \le 50).

第一行包含一个整数 tt(1≤t≤1041 \le t \le 10^4)—— 测试用例的数量。

每个测试用例由一行组成,包含三个整数 n,m,dn, m, d(1≤n,m,d≤501 \le n, m, d \le 50)。

输出格式

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

对于每个测试用例,输出一个整数——即所需的最少塔数。

输入输出样例

  • 输入#1

    3
    8 10 20
    8 1 20
    5 3 2

    输出#1

    3
    1
    5

说明/提示

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.

在第一个例子中,可以建造三座塔,其高度分别为 33、22 和 33 个箱子。

在第二个例子中,所有箱子的耐久度均足够高,足以建造一座包含 88 个箱子的塔。

在第三个例子中,箱子的重量超过了其耐久度,因此它们无法彼此叠放。结果,必须建造 55 座独立的塔。

输入解题思路,AI测评打分。不知道怎么写?

首页