#K55592. Average Task Completion Times
Average Task Completion Times
Average Task Completion Times
You are given the recorded times of tasks completed by different participants. Each participant may complete one or more tasks. Your task is to compute the average time each participant took to complete their tasks.
The average for a participant is calculated using the formula:
[ \text{average} = \frac{\text{total time}}{\text{number of tasks}} ]
For each participant, output their ID followed by their average time, one pair per line, with participant IDs in increasing order.
inputFormat
The input is given via standard input (stdin) in the following format:
- The first line contains an integer N, the number of participants.
- The second line contains an integer M, the number of task records.
- The next M lines each contain two values: an integer participant_id and a floating point number time, representing the time taken for a task by that participant.
You may assume that participant IDs are positive integers and are in the range 1 to N.
outputFormat
The output should be sent to standard output (stdout). For each participant (from 1 to N), output a line containing the participant's ID and the average time taken for their tasks. The values should be separated by a space. If a participant does not have any tasks recorded, you may output 0.0 as their average time.
## sample1
1
1 5.0
1 5.0
</p>