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)