require 'bigdecimal'
def calc_standard_dev(scores)
  length = scores.length
  avarage = scores.inject(:+)/length
  BigDecimal(avarage.to_s).floor(8).to_f
  tmp = 0
  for i in 0..(length-1)
    tmp += (scores[i]- avarage)**2
  end
  standard_dev = (tmp/length)**0.5
  return standard_dev
end

n = 5
scores = [70, 80, 100, 90, 20]

puts calc_standard_dev(scores)