URI Online Judge Solution| 1005 Average 1

Problem:
https://www.urionlinejudge.com.br/judge/en/problems/view/1005

Solution:

It actually use weighted average/mean
You can check this link for weighted mean   http://www.mathsisfun.com/data/weighted-mean.html