49. Sum and Average
Foundation1000 ms256 MBSolved by 0%
Print the sum of the array, then its average rounded down to a whole number, separated by a single space.
Rounding down means -2.4 becomes -3, not -2.
Constraints - `1 ≤ n ≤ 100000` - `-1000000 ≤ a[i] ≤ 1000000`
Input
The first line contains an integer n.
The second line contains n space-separated integers.
Output
Print two integers on one line, separated by a single space — the sum, then the average rounded DOWN.
Input5
1 2 3 4 5
Output15 3
Notedivides exactly
Input4
1 2 3 5
Output11 2
Notehas a remainder, so the average rounds down
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution