14703 - Average score   

Description

Write a program to calculate average scores.
Suppose there are s students taking the same c courses. The program should compute the average score for each student, as well as the average score for each course across all students.

  • Input:

    • The first line contains two integers: s and c.
    • The following s lines each represent one student’s scores. Each line contains c numbers, where the j-th number represents that student’s score in the j-th course.

  • Output:

    • A total of s + c lines.

    • The first s lines each contain the average score of one student.

    • The next c lines each contain the average score of one course across all students.

  • Constraints:

    • 0 < s ≤ 100

    • 0 < c ≤ 100

Input

First line: s, c.

Following s lines each represent one student's score, c represents the student's score in the j-th course.

Ex. 3 4

87 89 97 89

78 100 76 98

99 90 89 94 

Output

A total of s + c lines.

The first s lines each contain the average score of one student.

The next c lines each contain the average score of one course across all students.

Ex. 90

88

93

88

93

87

93

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss