fork download
  1. shohkin = [100, 50, 30,20, 10, 0]
  2. data = []
  3. while w = gets
  4. data << w.split()
  5. end
  6. data = data.zip(shohkin)
  7. .map{|e|e.flatten }
  8. .select{|e|e[-1]}
  9. h={}
  10. data.map { |e|
  11. h[e[1]]||=[0,0]
  12. h[e[1]][0]+=e[2]
  13. h[e[1]][1]+=1
  14. }
  15. h.map { |e| e[1][0]=e[1][0]/1.0/e[1][1] }
  16. h[data[-1][1]]=[0,0] if (data[5] && (data[4][1]==data[5][1]))
  17. data.delete_at(-1)
  18. data.map { |e| printf("%s %g\n",e[0],h[e[1]][0]) }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty