Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions

Question

1. Communicating courses and programs to employees.

Answered: 1 week ago

Question

6. Testing equipment that will be used in instruction.

Answered: 1 week ago