CF402A.Nuts

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You have a nuts and lots of boxes. The boxes have a wonderful feature: if you put x (x ≥ 0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into x + 1 sections.

You are minimalist. Therefore, on the one hand, you are against dividing some box into more than k sections. On the other hand, you are against putting more than v nuts into some section of the box. What is the minimum number of boxes you have to use if you want to put all the nuts in boxes, and you have b divisors?

Please note that you need to minimize the number of used boxes, not sections. You do not have to minimize the number of used divisors.

你有 aa 颗坚果和大量盒子。这些盒子有一个奇妙的特性:若在盒子中放入 xx(x≥0x \geq 0)个隔板(即用于分隔盒子的特殊挡板),则该盒子将被划分为 x+1x + 1 个区域。

你崇尚极简主义。因此,一方面,你反对将任意一个盒子划分成超过 kk 个区域;另一方面,你反对在盒子的任意一个区域内放入超过 vv 颗坚果。若你想把全部 aa 颗坚果装入盒子,且你仅有 bb 个隔板可用,那么你最少需要使用多少个盒子?

请注意:你需要最小化的是所用盒子的数量,而非区域总数。你无需最小化所用隔板的数量。

输入格式

The first line contains four space-separated integers k, a, b, v (2 ≤ k ≤ 1000; 1 ≤ a, b, v ≤ 1000) — the maximum number of sections in the box, the number of nuts, the number of divisors and the capacity of each section of the box.

第一行包含四个以空格分隔的整数 kk、aa、bb、vv(2 ≤ k ≤ 10002 \le k \le 1000;1 ≤ a, b, v ≤ 10001 \le a, b, v \le 1000)—— 分别表示盒子最多可划分的段数、坚果总数、隔板总数以及盒子每段的容量。

输出格式

Print a single integer — the answer to the problem.

输出一个整数——该问题的答案。

输入输出样例

  • 输入#1

    3 10 3 3

    输出#1

    2
  • 输入#2

    3 10 1 3

    输出#2

    3
  • 输入#3

    100 100 1 1000

    输出#3

    1

说明/提示

In the first sample you can act like this:

  • Put two divisors to the first box. Now the first box has three sections and we can put three nuts into each section. Overall, the first box will have nine nuts.
  • Do not put any divisors into the second box. Thus, the second box has one section for the last nut.

In the end we've put all the ten nuts into boxes.

The second sample is different as we have exactly one divisor and we put it to the first box. The next two boxes will have one section each.

在第一个样例中,你可以按如下方式操作:

  • 将两个隔板放入第一个盒子。此时第一个盒子被分为三个区域,每个区域可放入三颗坚果。因此,第一个盒子总共将容纳九颗坚果。
  • 第二个盒子中不放入任何隔板。于是,第二个盒子只有一个区域,用于放置最后一颗坚果。

最终,我们已将全部十颗坚果放入盒子中。

第二个样例有所不同:我们恰好只有一块隔板,并将其放入第一个盒子。接下来的两个盒子各自只有一个区域。

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

首页