← 返回 stripe 的题目列表Processing Invoices and Payments
类型:online_judge
Given input containing payment and invoice details, write a program to process the following tasks:
Receive an input string formatted with several comma-separated items, including one payment item and multiple invoice items.
The first task is to find the invoice matching the payment and output the matched invoice details.
The second task is to find an invoice with an exact matching payment amount and the nearest due date, and output its details.
The third task is to allow input of a range of amounts and output the most precisely matched invoice within this range.
All tasks should be accomplished using loops.
Test Cases:
Input: "paymentx,600,Paying off: invoiceX, invoicea,2024-03-22,100, invoiceb,2024-02-05,400, invoicex,2025-05-20,1000" Output: "Matched Invoice: None"
Input: "paymentx,400,Paying off: invoiceX, invoicea,2024-03-22,100, invoiceb,2024-02-05,400, invoicex,2025-05-20,1000" Output: "Matched Invoice: invoiceb"
Input: "paymentx,800,Paying off: invoiceX, invoicea,2024-03-22,100, invoiceb,2024-02-05,400, invoicex,2025-05-20,1000" Output: "Matched Invoice in Range: None"
Input: "paymentx,550-750,Paying off: invoiceX, invoicea,2024-03-22,100, invoiceb,2024-02-05,400, invoicex,2025-05-20,1000" Output: "Matched Invoice: None"
Input: "paymentx,900-1100,Paying off: invoiceX, invoicea,2024-03-22,100, invoiceb,2024-02-05,400, invoicex,2025-05-20,1000" Output: "Matched Invoice in Range: invoicex"
Example
Input
paymentx,600,Paying off: invoiceX, invoicea,2024-03-22,100, invoiceb,2024-02-05,400, invoicex,2025-05-20,1000