#K15811. Frequent Borrowers
Frequent Borrowers
Frequent Borrowers
You are given a list of borrowing records. Each record consists of three items separated by spaces: an integer id, a date in the format \(MM-DD\), and a name. Your task is to find all frequent borrowers who have borrowed more than three times. For each frequent borrower, compute their total dues as \(\text{count} \times 100\). If there is no borrower with more than three borrowings, output no frequent borrower
.
The result should be printed to standard output. In case there are multiple frequent borrowers, sort them first by total dues in descending order and then by id in ascending order. Each qualifying borrower should be printed on a new line in the format:
[ \texttt{id name dues} ]
inputFormat
The input is read from standard input and has the following format:
N record_1 record_2 ... record_N
Here, the first line contains an integer \(N\), representing the number of borrowing records. Each of the following \(N\) lines contains a borrowing record with three space-separated fields: id
(an integer), date
(in MM-DD format) and name
(a string without spaces).
outputFormat
If there is at least one frequent borrower (borrow count greater than 3), output each frequent borrower on a separate line in the format:
id name dues
Records must be sorted by dues in descending order; if two borrowers have the same dues, sort by id in ascending order. If no borrower qualifies as frequent, print no frequent borrower
.
3
101 03-15 Alice
102 03-15 Bob
103 03-15 Charlie
no frequent borrower