A9441 | Nuts
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
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.
输出格式
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.
- 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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted