Question: Language C programming, just use library stdio.h only Tambourine Tower Bibi is very obsessed with tambourines so she wants to build a tambourine tower. She

Language C programming, just use library stdio.h only

Tambourine Tower

Bibi is very obsessed with tambourines so she wants to build a tambourine tower. She has bought N tambourines where each tambourine is bought on a particular day (Bibi never buys more than one tambourine on one day). Now Bibi has Q questions, on each question she wants to know how many tambourines she has bought before or after a date Bi . For the sake of simplicity lets assume that every month has exactly 30 days which means that we assume dates like February 30th are valid dates.

Format Input

The first line contains a single number N. The next N lines contain Ai which is the date when Bibi bought the i-th tambourine, the date is given in YYYY/MM/DD format. The next line contains Q followed by Q more lines where each line contains an integer Ki and a date Bi . If Ki is 0 it means that Bibi wants to know how many tambourines she has bought before Bi , and if Ki is 1 it means that Bibi wants to know how many tambourines she has bought after Bi . Bi is also given in YYYY/MM/DD format.

Format Output

For each question, output one line starting with Case #X: (without quotes) where X is the question number (starting from 1) followed by the answer.

Constraints

1 N, Q 25000

0001 Y Y Y Y 9999

01 MM 12

01 DD 30

Ki 0, 1

Y Y Y Y consists of exactly 4 digits

MM, DD consist of exactly 2 digits

All values of Ai are different

All values of Ai are given in an increasing order

Sample Input 1 (standard input)

7

0001/01/05

1945/08/17

1970/01/01

2019/06/21

2020/05/30

2020/09/11

2021/02/30

6

0 0001/01/01

0 2020/09/11

1 1970/01/01

0 2020/09/12

1 2000/01/01

0 9999/12/30

Sample Output 1 (standard output)

Case #1: 0

Case #2: 5

Case #3: 4

Case #4: 6

Case #5: 4

Case #6: 7

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!