← 返回 doordash 的题目列表Calculate Dasher Payment
类型:online_judge
Given a series of orders, where each order contains the following information: orderId, dasherId, timestamp, and status (which can be either "ACCEPTED", "FULFILLED", or "CANCELED").
Write a function that, given a dasherId as input, outputs the total pay for that dasher. The pay is calculated as the number of ongoing deliveries multiplied by a base pay (0.3).
Sample Input:
[
{"orderId": "1", "dasherId": "1", "timestamp": 15, "status": "ACCEPTED"},
{"orderId": "2", "dasherId": "1", "timestamp": 20, "status": "ACCEPTED"},
{"orderId": "1", "dasherId": "1", "timestamp": 26, "status": "FULFILLED"},
{"orderId": "2", "dasherId": "1", "timestamp": 35, "status": "CANCELED"}
]
Sample Output:
0.3
Example
Input
[{"orderId": "1", "dasherId": "1", "timestamp": 15, "status": "ACCEPTED"}, {"orderId": "2", "dasherId": "1", "timestamp": 20, "status": "ACCEPTED"}, {"orderId": "1", "dasherId": "1", "timestamp": 26, "status": "FULFILLED"}, {"orderId": "2", "dasherId": "1", "timestamp": 35, "status": "CANCELED"}]
1
Output
0.3