Answers to ACM platform questions of Shandong University of Technology

Source: Internet
Author: User

Number of dominant values Time Limit: 1000 ms Memory limit: 65536 K any questions? Click Here ^_^ The question description is known to be an integer array of f [] and g []. The elements are sorted in ascending order. Please write a program, calculate the logarithm of f [] greater than the element in g. In other words, f [0] is bigger than how many elements in g [], and f [1] is bigger than how many elements in g []. The sum of these values is the answer.
For example, if f [] contains 1, 3, 5, 7, 9, and g [] contains 2, 3, 4, 7, and 8.
So:
F [0] is smaller than all elements in g;
F [1] is larger than g [0;
F [2] is larger than g [0], g [1], and g [2;
F [3] is larger than g [0], g [1], and g [2;
F [4] is larger than g [0], g [1], g [2], g [3], and g [4;
So the answer is 0 + 1 + 3 + 3 + 5 = 12. Enter the first two integers, m, n (1 ≤ m, n ≤ 1000), representing the length of the array f [], g [], respectively.
The second row has m elements, which are arrays f [].
The third row has n elements, which are array g []. Output output control value. Sample Input
5 51 3 5 7 92 3 4 7 8
# Include
Void main ()
{
Int a [1000], B [1000], m, n, I, j, p = 0;
Scanf ("% d", & m, & n );
For (I = 0; I {
Scanf ("% d", & a [I]);
}
For (j = 0; j {
Scanf ("% d", & B [j]);
}
For (I = 0; I {
For (j = 0; j If (a [I]> B [j])
P ++;
}
Printf ("% d \ n", p );
}

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.