Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ (structures) and without library please and try not to be limit exceed. A queue Cost: 3 | Solved: 0 Memory limit: 256 Mb

image text in transcribed

using c++ (structures) and without library please and try not to be limit exceed.

A queue Cost: 3 | Solved: 0 Memory limit: 256 Mb Time limit: 1000 ms Input file: stdin Output file: stdout Task: Civil countries usually have k ticket windows on a railway station but there's only one waiting queue. The service works in such a way: initially, when all ticket windows are free, the first k people from the queue take their places at windows; all other people wait for their turn. As soon as a client gets served, the window calls for another client, the first one from the queue. This continues until all people are served. Find the minimal time needed to serve all clients. Input: The first line contains two integers n and K (1sn s105, 1 sk s104) - the quantity of clients and ticket windows respectively. The second line contains n natural numbers. Each ith number determines the time t; (1st;s 105) required to serve the ith client from the queue. Output: The minimal time needed to serve the queue. Example: Input Output 5 2 6 31 1 2 3 73 1 2 3 4 5 3 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

4. You also spoke too (quick, quickly) ________.

Answered: 1 week ago

Question

Analyse the various techniques of training and learning.

Answered: 1 week ago