#K6976. Taco Running Statistics
Taco Running Statistics
Taco Running Statistics
Jason has been tracking his running distances over several days. Given an integer n representing the number of days and a list of n integers representing the distance run each day, your task is to compute the following:
- The total distance run, i.e., \(\sum_{i=1}^{n} d_i\).
- The maximum distance run in a single day, i.e., \(\max\{d_1, d_2, \dots, d_n\}\).
- The one-based index of the first day on which the maximum distance occurred.
The input is provided via standard input and the output must be printed to standard output. The output should be the three calculated values separated by spaces on one line.
inputFormat
The first line of input contains an integer (n), which is the number of days. The second line contains (n) space-separated integers representing the distances run on each day.
outputFormat
Output a single line with three space-separated integers: the total distance run, the maximum distance run in a single day, and the one-based index of the first occurrence of the maximum distance.## sample
5
3 7 2 7 5
24 7 2
</p>