I have a question in a question, and I hope you guys can help me, the question itself is not how to develop the issue, this is not the problem, the problem lies in the logic of the issue that I am not getting understand, the question is this:
Existing legislation requires banks to start client within 20 minutes after the client enters the queue of the bank branch. The queue is unique, so a free box asks the first customer in the queue to come to your booth to be attended. (Let's ignore the problem of priority customers here, elderly, pregnant women, people with special needs, etc.). assuming also that no mailbox serves two clients at the same time.
Your program will receive the number of active boxes in the branch, the number of customers, and for each customer, two information, namely the time customer in the queue, and the duration of the customer's client. Initially all boxes are empty, since the agency just opened Your problem is to determine the number of customers will wait more than 20 minutes to have your service started.
Entry:
The first line of the entry contains two integers separated by a blank space. The first, C, is the number of active boxes in the bank branch The second, N, the number of customers who will seek the agency that day. The next N lines will have each an information about a client, consisting of two integers, T and D, separated by a space. The integer T gives the moment in that the customer enters the queue, in minutes, from the instant of opening of the agency. The integer D provides, in minutes, the time necessary to serve the client. The rows are sorted by clients in the queue.
Suppose: