注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
1.
Web Services (AWS) is a cloud computing platform with multiple servers.
One of the servers is assigned to serve customer requests. There are n customer requests placed sequentially in a queue,
where the ith request has a maximum waiting time denoted by wait[i].
That is, if the ith request is not served within wait[i] seconds,
then the request expires and it is removed from the queue.
The server processes the request following the First In First Out (FIFO) principle.
The 1st request is processed first, and the nth request is served last.
At each second, the first request in the queue is processed.
At the next second, the processed request and any expired requests are removed from the queue.
Given the maximum waiting time of each request denoted by the array wait,
find the number of requests present in the queue at every second until it is empty.
Note:
If a request is served at some time instant t, it will be counted for that instant and is removed at the next inst, then the requests expires and it is removed from the queue. the server processess the request following the first in first out principle the 1st rquest is processed first and the nth request is served last. at each second, the first request in the queue is processed. at the next second, the processed request and any expired requetes are removed from queue. given the maximum waiting time of each request denoted by the array wait find the number of request present in the queue at every second unitli it is empety |