1001. Two brothers picking apples

Source: Internet
Author: User

Title Description

Second brother usually like to grow some of their own things, and to write programs and see the biggest hobby outside the movie. Recently, two elder brother species of an apple tree to harvest time, but due to the height of the two elder brother limit, some apples too high to pick up. So two brother borrowed a stool, step on top can pick more apples.

Second elder brother is a lazy action person, he wants to know how many apples he can pick before picking an apple, if it is too little (the apple tree is very lush, mainly because of height), he would rather sit under the tree under the Apple himself fell to hit the head.

Input format

Enter a total of two rows.

The 1th line has 3 integers, representing the height of the elder brother, the height of the stool and the number of apples N.

The 2nd line has n integers, each representing the height of each apple.

Output format

Output an integer m, which means that the number of apples the elder brother can pick up is M.

Description

For all data: positive integers below 1000, the number of apples1≤n≤

。

Sample Input
177 40 10180 151 152 193 168 255 278 303 211 217
Sample Output
7



#include <iostream>
using namespace Std;

int main () {
int h1,h2,n,p,m=0;
cin>>h1>>h2>>n;
for (int i=0;i<n;i++) {
cin>>p;
if (P<=H1+H2) {
m++;
}
}
cout<<m;
return 0;


1001. Two brothers picking apples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.