← 返回 doordash 的题目列表Calculate Dasher Pay with Multi Order Rate
类型:online_judge
You are in charge of implementing the Dasher payment model. The first version of the payment model is naively based on how much time a Dasher spends on each order. Given the sequence of accepted/fulfilled order activities from a given Dasher on a given day, calculate the Dasher pay based on the following payment rules:
Base pay rate: $0.3 per minute
Multi-order pay rate: ongoing deliveries * base pay rate (when Dasher is delivering multiple orders at the same time)
Assumptions:
All order activities are from the same calendar day
Order activity sequence is valid; all orders are fulfilled by end of day (no duplicates, no fulfillment without pickup, no pickup without fulfillment, etc).
Example:
Input: 06:15: Dx accepted order A 06:18: Dx accepted order B 06:36: Dx fulfilled order A 06:45: Dx fulfilled order B
Output: final pay: $14.4
Explanation: 06:15 - 06:18 -> pay = 3 * 0.3 -> $0.9 06:18 - 06:36 -> pay = 2 orders * 0.3 * 18 -> $10.8 06:36 - 06:45 -> pay = 0.3 * 9 = $2.7
Example
Input
06:15: Dx accepted order A
06:18: Dx accepted order B
06:36: Dx fulfilled order A
06:45: Dx fulfilled order B