A10493 | Juicer
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Kolya is going to make fresh orange juice. He has $n$ oranges of sizes $a_{1},a_{2},...,a_{n}$ . Kolya will put them in the juicer in the fixed order, starting with orange of size $a_{1}$ , then orange of size $a_{2}$ and so on. To be put in the juicer the orange must have size not exceeding $b$ , so if Kolya sees an orange that is strictly greater he throws it away and continues with the next one.
The juicer has a special section to collect waste. It overflows if Kolya squeezes oranges of the total size strictly greater than $d$ . When it happens Kolya empties the waste section (even if there are no more oranges) and continues to squeeze the juice. How many times will he have to empty the waste section?
The juicer has a special section to collect waste. It overflows if Kolya squeezes oranges of the total size strictly greater than $d$ . When it happens Kolya empties the waste section (even if there are no more oranges) and continues to squeeze the juice. How many times will he have to empty the waste section?
输入格式
The first line of the input contains three integers $n$ , $b$ and $d$ ( $1<=n<=100000$ , $1<=b<=d<=1000000$ ) — the number of oranges, the maximum size of the orange that fits in the juicer and the value $d$ , which determines the condition when the waste section should be emptied.
The second line contains $n$ integers $a_{1},a_{2},...,a_{n}$ ( $1<=a_{i}<=1000000$ ) — sizes of the oranges listed in the order Kolya is going to try to put them in the juicer.
The second line contains $n$ integers $a_{1},a_{2},...,a_{n}$ ( $1<=a_{i}<=1000000$ ) — sizes of the oranges listed in the order Kolya is going to try to put them in the juicer.
输出格式
Print one integer — the number of times Kolya will have to empty the waste section.
输入输出样例
输入 #1
2 7 10 5 6
输出 #1
1
输入 #2
1 5 10 7
输出 #2
0
输入 #3
3 10 10 5 7 7
输出 #3
1
输入 #4
1 1 1 1
输出 #4
0
In the first sample, Kolya will squeeze the juice from two oranges and empty the waste section afterwards.
In the second sample, the orange won't fit in the juicer so Kolya will have no juice at all.
In the second sample, the orange won't fit in the juicer so Kolya will have no juice at all.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted