Wuhan University of Science and Technology Acm:1005:soapbear and Honey

Source: Internet
Author: User

Problem Descriptionsoapbear is the mascot of WHUACM team. Like the other bears, Soapbear loves honey very much, so he decides-get some honeycombs for honey. There was N honeycombs hanging on some trees, numbered from 1 to N, and the height of honeycomb I was Hi. The height soapbear can reach the is Hx, so he wonders how many honeycombs he can get in most. Inputthere is multiple test cases in the input file. There first line of the input was an integer T indicates the number of the the test cases. Each test case is starts with a line containing the integer, N and HX (0 < n <= 200000, 0 < HX < 200). Next, there is a line of n integers specifying hi (1 <= i <= N, 0 < Hi < 200). Outputfor each test case, output a line with an integer indicates the number of honeycombs soapbear can get in most. Sample Input
22 180170 1903 180180 170 190
Sample Output
12
HINT

Note:input/output of scanf/printf is faster than cin/cout, so if a problem have huge Input data, use CIN would probably get A time Limit exceeded.

1#include <stdio.h>2 #defineN 2000013 intMain ()4 {5     intn,m,hx=0;6     intA[n];7scanf"%d",&n);8      while(n--)9     {Ten         intresult=0; One          for(intI=0; i<n;i++) Aa[i]=0; -scanf"%d",&m); -scanf"%d",&Hx); the          for(intj=0; j<m;j++) -         { -scanf"%d",&a[j]); -         } +          for(intk=0; k<m;k++) -         { +             if(a[k]<=Hx) Aresult++; at         } -printf"%d\n", result); -     } -     return 1; -}

Wuhan University of Science and Technology Acm:1005:soapbear and Honey

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.