Skip to content

Instantly share code, notes, and snippets.

@cappert
Created February 8, 2010 21:49
Show Gist options
  • Save cappert/298620 to your computer and use it in GitHub Desktop.
Save cappert/298620 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
hache = {"A" => 3107227, "B" => 3814675 , "C" => 6639564 , "D" => 741901 , "E" => 7579381 , "F" => 4428177 , "G" => 3842022 }
sum = {}
hache.each { |name, size|
copy = hache.dup
copy.delete(name)
sum[name] =copy.values.inject {|x, y| x += y}
}
max = {"" => 0}
sum.each { |name, size|
if size > max.values.to_s.to_i
if size < 38877642752
max = {name, size}
end
end
}
puts "L'élément à enlever est " + max.keys.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment