Created
September 23, 2011 08:25
-
-
Save dpsk/1236955 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total_peoples = 0 | |
puts "how much groups?" | |
groups = gets.chomp.to_i | |
majority_of_each_group = Array.new | |
groups.times do | |
puts "how much people in group?" | |
peoples = gets.chomp.to_i | |
majority_of_each_group << peoples/2 + 1 | |
end | |
majority_of_each_group.sort[0..groups/2].each { |gp| total_peoples += gp } | |
puts "You need just a #{total_peoples} for win those votes!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment