A regional records archive keeps physical storage boxes in deep vaults. When a researcher submits a retrieval request, they name the exact date by which they need the box, and the archive staff separately logs the date the box was actually pulled and handed over. A retrieval counts as prompt only when the box was pulled on precisely the date it was requested for; any other pull date makes it a delayed retrieval. Given a log of retrieval requests, determine what percentage of them were prompt.
The first line contains a single integer n, the number of logged requests. Each of the next n lines contains two strings separated by a single space: requestedDate and fulfilledDate, both given in the fixed format YYYY-MM-DD (four-digit year, two-digit month, two-digit day, using leading zeros where needed).
Print a single number: the percentage of requests that were prompt (fulfilledDate exactly equal to requestedDate), rounded to exactly two decimal places.
YYYY-MM-DD.Example 1
Input
4 2021-01-01 2021-01-01 2021-01-02 2021-01-03 2021-01-03 2021-01-03 2021-01-04 2021-01-05
Expected
50.00
Explanation
Of the 4 requests, request 1 (2021-01-01 -> 2021-01-01) and request 3 (2021-01-03 -> 2021-01-03) were pulled on the exact requested date, so they are prompt; requests 2 and 4 were pulled a day later and are delayed. That is 2 out of 4 prompt retrievals, i.e. 50.00%.
Example 2
Input
3 2022-05-10 2022-05-12 2022-05-11 2022-05-11 2022-05-12 2022-05-15
Expected
33.33
Explanation
Only the second request (2022-05-11 -> 2022-05-11) matches its requested date exactly; the other two were pulled on later dates. That is 1 out of 3 prompt retrievals, which is 1/3 * 100 = 33.33% when rounded to two decimal places.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →