NOIP2005 Universal group Tata Apple Picking

Source: Internet
Author: User

There is an apple tree in the Tautau's yard, and 10 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.

Now it is known that 10 apples to the height of the ground (100 to 200 (including 100 and 200) of the integer (in centimeters)), and the Tata handle to reach the maximum height (100 to 120 (including 100 and 120) of the integer (in centimeters)), Please help Tata calculate the number of apples she can pick. If she touches an apple, the Apple will fall.

Input format:

Two rows of data. The first act of 10 apples to the height of the ground. The second act Tata the maximum height that can be reached when the hand is stretched straight.

output Format:

Row, this line contains only an integer that represents the number of apples that Tata can pick up.

Analysis:

  A traversal comparison, can pick up on the addition of one.

1#include <cstdio>2 3 using namespacestd;4 5 intdata[Ten];6 intN,ans;7 8 intMain ()9 {Ten      for(intI=0;i<Ten; i++) Onescanf"%d",&data[i]); Ascanf"%d",&n); -n+= -; -      for(intI=0;i<Ten; i++) the      if(data[i]<=n) ans++; -printf"%d", ans); -     return 0; -}

NOIP2005 Universal group Tata Apple Picking

Related Article

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.