← 返回 doordash 的题目列表Calculate Total Payment for Dasher
类型:online_judge
Design a function to calculate the total payment for a Dasher. Given a log of operations, each line contains a timestamp and the corresponding operation description. The timestamp format is "YYYY-MM-DD HH:MM:SS". Operations include: START_WORK, END_WORK, and TIP. You need to calculate the working time of the Dasher between START_WORK and END_WORK and compute the payment based on time, adding all tips. Assume the hourly wage is $20. Ensure timestamps are in sequential order. Finally, return the Dasher's total payment. Assume input data is valid and continuous. Sample input:\n\ntimestamps and operations:\n\n"2025-12-03 10:00:00 START_WORK"\n"2025-12-03 13:00:00 END_WORK"\n"2025-12-03 13:15:00 TIP 10"\n\nshould return: $70
Example
Input
2025-12-03 10:00:00 START_WORK\n2025-12-03 13:00:00 END_WORK\n2025-12-03 13:15:00 TIP 10