Question
Jojo and his friends are going to the amusement park. They want to ride Q attractions, however the i-th attraction has a minimum height limit
Jojo and his friends are going to the amusement park. They want to ride Q attractions, however the i-th attraction has a minimum height limit that is Bi and a maximum height limit that is Ci . This means that someone with the height H can only ride the attraction if their height satisfies the equation Bi H Ci . Can you help them to tell how many people can ride each attraction?
Format Input
The first line contains a single number N which is the number of people who are going to the amusement park (including Jojo). The next N lines contain Ai which is the height of the i-th person. The next line contains Q followed by Q more lines where each line contains integers Bi and Ci .
Format Output
For each attraction, output one line starting with Case #X: (without quotes) where X is the attraction number (starting from 1) followed by a number telling how many people can ride that attraction.
Constraints
1 N, Q 30000
1 Ai 100000
1 Bi Ci 100000
All values of Ai are different
All values of Ai are given in an increasing order
Sample Input 1 (standard input)
10
1 3 5 8 12 16 28 69 153 9999
8
1 3
1 5
1 199
4 500
152 152
70 152
153 153
153 9998
Sample Output 1 (standard output)
Case #1: 2
Case #2: 3
Case #3: 9
Case #4: 7
Case #5: 0
Case #6: 0
Case #7: 1
Case #8: 1
NOTE: USE C LANGUAGE, USE stdio.h library (MUST) or string.h if needed (DONT USE stdlib.h and algorithm library)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started