Bupt-Sort (2009)

Source: Internet
Author: User

Title describes the number of input inputs that are more than a few of the numbers that are less than B in the lookup sequence A, four rows per group
First line: sequence a number n
Second line: n number of (sequence a), ascending order
Third line: Sequence b number M

Line four: Number of M (of sequence B) in ascending order

Line five: I denotes number i in B

Sample input for output to sequence A, the number of outputs less than B
31 2 341 2 3 44
Sample output
3
Source

2009 Machine Test C question

#include <algorithm>#include<iostream>#include<cstdio>using namespacestd;intMain () {intn=0;  while(cin>>N) {intm=0, a[ -],b[ -],key=0         for(intI=0; i<n;i++) Cin>>A[i]; CIN>>m;  for(intI=0; i<m;i++) Cin>>B[i]; CIN>>key; intnum=b[key-1],count=0; if(a[0]>=num) {cout<<"0"<<Endl; Continue; }        int*t=lower_bound (a,a+n,num);  for(intI=0; a[i]<*t;i++) {Count++; } cout<<count<<Endl; }    return 0;}

Bupt-Sort (2009)

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.