Hello and welcome to the challenge!
In this challenge you have to schedule your tasks. This time you use the Shortest Job First algorithm. In this way, you do tasks in order from the shortest to the longest. Additionally, in your set of tasks is one "Special task" and your goal is to calculate how many hours you need to end this task. If the jobs take the same time then it is First In First Out (FIFO).
- The first line of the standard input contains the number of tasks you have (N).
- The second line contains
t1, t2,..., tN(separated by a single space), denoting the number of hours you need to do each task.
- The third line contains one integer denoting index (
i) of the "Special Task" (zero-indexed).
- To the standard output print one integer denoting number of hours you need to do "Special Task"
0 < N <= 25
0 < t1, t2,..., tN <= 100
0 <= i < N
Did you like this challenge and would like to try your hand at some interesting big programming competitions? Check what’s all over the news in tech world in June 2019 in our article with upcoming IT Conferences, Hackathons and Online Challenges in July 2019.
Have fun and good luck! :)