#K59402. Minimum Total Time for Task Completion
Minimum Total Time for Task Completion
Minimum Total Time for Task Completion
This problem requires you to calculate the minimum total time needed to complete a sequence of tasks. Each task is represented by a unique task ID, a priority, and a duration. Although tasks are provided with priorities, the overall completion time is simply the sum of all task durations.
For a dataset with (n) tasks where each task has a duration (d_i), the total time (T) is computed as:
(T = \sum_{i=1}^{n} d_i).
The input consists of multiple datasets. Each dataset starts with an integer indicating the number of tasks, followed by that many lines with task details. A dataset beginning with a single zero marks the end of input.
inputFormat
Standard input consists of multiple datasets. Each dataset starts with an integer (n) (the number of tasks), followed by (n) lines. Each of these (n) lines contains three values separated by spaces: a task ID (string), a priority (integer), and a duration (integer). A line containing just 0
indicates the end of input.
outputFormat
For each dataset, output a single line containing the total duration (an integer) required to complete all tasks in that dataset.## sample
3
T1 2 30
T2 1 20
T3 3 10
2
T1 1 40
T2 2 20
0
60
60
</p>