CF709A.Juicer

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

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?

科里亚打算制作新鲜的橙汁。他有 nn 个橙子,大小分别为 a1,a2,…,ana_1, a_2, \dots, a_n。科里亚将按固定顺序将这些橙子依次放入榨汁机中,即先放大小为 a1a_1 的橙子,再放大小为 a2a_2 的橙子,依此类推。要放入榨汁机,橙子的大小不能超过 bb;因此,若科里亚遇到一个严格大于 bb 的橙子,他就将其丢弃,并继续处理下一个橙子。

榨汁机有一个专门收集废料的区域。当科里亚所挤压的橙子的总大小严格超过 dd 时,该废料区就会溢出。此时,科里亚必须清空废料区(即使之后已无橙子可处理),然后继续榨汁。问:科里亚总共需要清空废料区多少次?

输入格式

The first line of the input contains three integers n, b and d (1 ≤ n ≤ 100 000, 1 ≤ b ≤ d ≤ 1 000 000) — 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 ≤ 1 000 000) — sizes of the oranges listed in the order Kolya is going to try to put them in the juicer.

输入的第一行包含三个整数 nn、bb 和 dd(1 ≤ n ≤ 100 0001 ≤ n ≤ 100\,000,1 ≤ b ≤ d ≤ 1 000 0001 ≤ b ≤ d ≤ 1\,000\,000)——分别表示橙子的数量、能放入榨汁机的最大橙子尺寸,以及决定何时清空废料区的参数 dd。

第二行包含 nn 个整数 a1, a2, ..., ana_1,\,a_2,\,...,\,a_n(1 ≤ ai ≤ 1 000 0001 ≤ a_i ≤ 1\,000\,000)——表示 Kolya 将按此顺序尝试放入榨汁机的橙子尺寸。

输出格式

Print one integer — the number of times Kolya will have to empty the waste section.

输出一个整数——Kolya 需要清空废料区的次数。

输入输出样例

  • 输入#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.

在第一个样例中,科里亚将从两个橙子中榨汁,并在之后清空废料槽。

在第二个样例中,橙子无法放入榨汁机,因此科里亚完全无法榨出果汁。

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

首页