The Flood Season Harvest

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
C, C++, Java, Pascal, Perl, Python, Sed, Text

The Flood Season Harvest

After the Nile floods recede, farmers measure their grain harvest in baskets. The vizier needs the total grain and the floor of the average per farm for the Pharaoh's official records.

Your Task

Given N integers (grain counts), output the total sum and the floor of the average (integer division: sum / N).

Input Specification

The first line contains an integer T — the number of reports. Each report starts with N on its own line, followed by N space-separated integers.

Output Specification

For each report print two lines:
Total: <sum>
Average: <floor(sum/N)>

Sample Input
2
4
10 20 30 40
3
7 8 9
Sample Output
Total: 100
Average: 25
Total: 24
Average: 8
Constraints

1 \le T \le 10\,000
1 \le N \le 10\,000
1 \le each value \le 100\,000

Test cases available here!


Comments


  • 0
    LightSpeed47  commented on May 26, 2026, 5:47 p.m. edited

    a


  • 0
    LightSpeed64  commented on May 25, 2026, 7:20 p.m.

    This one is honestly harder than the second one.


    • 0
      sankalp  commented on May 28, 2026, 11:25 p.m.

      That is true , especially for c++ programmers