← 返回 rippling 的题目列表Calculate Driver Costs
类型:online_judge
Problem Description
You are responsible for managing the rental costs for drivers. Each driver has a start_date and an end_date. Your task is to calculate the cost for each day included in the rental period.
Requirements
Given each driver's start_date and end_date, calculate the total cost from the starting rental to a specified date.
Dates are represented in epoch time (total seconds since January 1, 1970).
Input
A set of drivers' start_date and end_date, and a date for cost calculation.
Output
The total cost for all rental days prior to the given date.
Test Cases
Input:
drivers = [(1609459200, 1609545600), (1609632000, 1609718400)]
date = 1609632000
Output: 2
Input:
drivers = [(1609459200, 1609545600)]
date = 1609459200
Output: 1
Example
Input
[(1609459200, 1609545600), (1609632000, 1609718400)]
1609632000