#!/usr/koeki/bin/ruby
# -*- coding: utf-8 -*-

require 'kconv'

soft = Hash.new

while line = gets
  if /(\S+)\s+(\d+)\s+(\d+)\s+(\d+)/ =~ line
     kati = $2.to_f / ($2.to_f+$3.to_f)
    soft[$1] = [$2.to_f,$3.to_f,$4,kati] 
  end
end

print"--チーム名------------+-勝ち-+-負け-+-引分--+-勝率---\n"

for team in soft.keys.sort {|a, b| soft[b][3] <=> soft[a][3]}

  result =  sprintf("%-23s%d%6d%6d%9.3f\n",
              team.toeuc.force_encoding("binary"),
              soft[team][0], soft[team][1], soft[team][2],
              soft[team][0]/(soft[team][0]+soft[team][1])).toutf8
  puts result

end

結果
--チーム名------------+-勝ち-+-負け-+-引分--+-勝率---
ドラゴンフライズ       77    51     8    0.602
アンツ                 78    53     5    0.595
ブックウォームス       75    52     9    0.591
モスキートーズ         65    65     6    0.500
スネイルズ             52    82     2    0.388
クリケッツ             50    83     3    0.376

説明
配列のなかに勝率を表わす"kati"という変数を作り勝率で並べ換えれるようにし
まし?た。
課題は1番までです。