Description

Kolya is going to make fresh orange juice. He has n oranges of sizes a1, a2, ..., an. Kolya will put them in the juicer in the fixed order, starting with orange of size a1, then orange of size a2 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?

Input

The first line of the input contains three integers nb 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 a1, a2, ..., an (1 ≤ ai ≤ 1 000 000) — sizes of the oranges listed in the order Kolya is going to try to put them in the juicer.

Output

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

Examples
input
2 7 10
5 6
output
1
input
1 5 10
7
output
0
input
3 10 10
5 7 7
output
1
input
1 1 1
1
output
0
Note

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.

题意:就是给你n个水果,有台榨汁机(最多一次性只能装b大小的水果,容量是d),如果超过容量就清理一次。问你要清理几次

解法:模拟,超过大小的可以不要,相加的和超过容量的就清零,num+1

#include<bits/stdc++.h>
using namespace std;
long long a[100005],b,d;
int main()
{
int n;
long long sum=0;
long long num=0;
cin>>n>>b>>d;
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]<=b)
{
sum+=a[i];
}
else
{
continue;
}
if(sum>d)
{
sum=0;
num++;
}
}
cout<<num<<endl;
return 0;
}

  

AIM Tech Round 3 (Div. 2) A的更多相关文章

  1. codeforce AIM tech Round 4 div 2 B rectangles

    2017-08-25 15:32:14 writer:pprp 题目: B. Rectangles time limit per test 1 second memory limit per test ...

  2. AIM Tech Round 3 (Div. 2)

    #include <iostream> using namespace std; ]; int main() { int n, b, d; cin >> n >> ...

  3. AIM Tech Round 3 (Div. 2) A B C D

    虽然打的时候是深夜但是状态比较好 但还是犯了好多错误..加分场愣是打成了降分场 ABC都比较水 一会敲完去看D 很快的就想出了求0和1个数的办法 然后一直wa在第四组..快结束的时候B因为低级错误被h ...

  4. AIM Tech Round 3 (Div. 2) B

    Description Vasya takes part in the orienteering competition. There are n checkpoints located along ...

  5. AIM Tech Round 3 (Div. 2) (B C D E) (codeforces 709B 709C 709D 709E)

    rating又掉下去了.好不容易蓝了.... A..没读懂题,wa了好几次,明天问队友补上... B. Checkpoints 题意:一条直线上n个点x1,x2...xn,现在在位置a,求要经过任意n ...

  6. AIM Tech Round 3 (Div. 2) B 数学+贪心

    http://codeforces.com/contest/709 题目大意:给一个一维的坐标轴,上面有n个点,我们刚开始在位置a,问,从a点开始走,走n-1个点所需要的最小路程. 思路:我们知道,如 ...

  7. AIM Tech Round 3 (Div. 2)D. Recover the String(贪心+字符串)

    D. Recover the String time limit per test 1 second memory limit per test 256 megabytes input standar ...

  8. AIM Tech Round 4 (Div. 2)ABCD

    A. Diversity time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  9. AIM Tech Round 4 (Div. 2)(A,暴力,B,组合数,C,STL+排序)

    A. Diversity time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...

随机推荐

  1. linux第5天 socket api

    IPv4套接口地址结构通常也称为“网际套接字地址结构”,它以“sockaddr_in”命名,定义在头文件<netinet/in.h>中 通用地址结构用来指定与套接字关联的地址.以socka ...

  2. Java里的File I/O

    Java的输入流主要由:InputStream和Reader作为基类,把持久化数据读入内存.输出流由OutputStream和Write类作为父类. 其中读如内存的时候,不可能一下去全读进去,需要一个 ...

  3. demo03linearlayoutdemo;

    package com.example.demo03linearlayoutdemo; import android.os.Bundle; import android.app.Activity; i ...

  4. kafka 0.8.x producer Example(scala)

    Producer 最简配置 metadata.broker.list参数指定broker地址,这里不需要填上所有的broker地址,但是如果只写一个,这个broker挂掉后就无法往topic中写入信息 ...

  5. ANDROID模拟火花粒子的滑动喷射效果

    转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 开篇废话: 年前换了一个手机,SONY的Z3C.这个手机在解锁屏幕时有一个滑动动画,类似火 ...

  6. sql except 用法,找两个表中非共同拥有的

    ;with tt as (select a.id as id from [dbo].[1234] a where a.id not in (select a.ProtocolID from Proto ...

  7. 夺命雷公狗---node.js---22之项目的构建在node+express+mongo的博客项目7之数据的修改

    在修改的时候和在PHP里面修改的一样,都是需要在列表页传个id过来才可以实现修改的,如下所示: 然后在后端接收到他传过来id的同时去读取该id的所有信息: 然后就开始写post处理数据方面的问题了,如 ...

  8. 【fedora】强制解除yum锁定

    运行yum makecache时出现yum update时候出现Another app is currently holding the yum lock解决方法yum被锁定了. 可以通过执行 rm ...

  9. ionic之AngularJS扩展 移动开发(视图导航一)

    目录: 内联模板 : script 路由机制 : 状态机 导航视图 : ion-nav-view 模板视图 : ion-view 导航栏 : ion-nav-bar 回退按钮 : ion-nav-ba ...

  10. vc获取特殊路径(SpecialFolder)

    %SystemDrive% 操作系统所在的分区号.如 C: %SystemRoot% 操作系统根目录.如 C:\WINDOWS %windir% 操作系统根目录.如 C:\WINDOWS %ALLUS ...