C language · Tata Pick apples 2

Source: Internet
Author: User

Algorithm to improve Tata Apple 2 time limit: 1.0s memory limit: 256.0MBProblem description There is an apple tree in the yard of Tautau, and N apples will be produced in every fall tree. When Apple matures, Tata will run to pick apples. Tata had a 30-centimetre-high bench, and when she couldn't pick it up with her hand, she would step on the bench and try again.
The height of n apples to the ground is now known, and the maximum height that can be reached when the Tata handle is stretched. If she touches an apple, the Apple will fall. Please help Tata calculate, after her looting, there are still a few apples on the apple tree. Input format input includes two rows of data. The first line consists of only two positive integers n (5<=n<=200) and M (60<=m<=200), indicating the number of apples and the height (in centimeters) the peach can reach. The second line contains an integer (in centimeters) of n between 100 and 200 (including 100 and 200) that represents the height of the apple to the ground, separated by a space between two adjacent integers. Output format output includes one row, which contains only an integer that represents the number of apples that Tata cannot pick up. Sample Input 10 110
100 200 150 140 129 134 167 198 200 111 Sample Output 5
1#include <stdio.h>2 intMain () {3     intn,m;4scanf"%d%d",&n,&m);5     intFruit[n];6     inthigh=m+ -;7     intflag=N;8      for(intI=0; i<n;i++){9scanf"%d",&fruit[i]);Ten         if(fruit[i]<=High ) { Oneflag--; A         } -     } -printf"%d", flag); the     return 0; -}

C language · Tata Pick apples 2

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.