Created
August 2, 2019 10:01
-
-
Save manojnaidu619/91e70fcdaed3d8f621b7749399eceeda to your computer and use it in GitHub Desktop.
Codechef solution for problem "Football" (problem code: MSNSADM1) in Ruby
This file contains hidden or 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
goal,foul,size,points,seg = [],[],[],[],[] | |
n = gets.to_i | |
n.times do | |
size << gets.to_i | |
g = gets.strip.split(/\s+/).map(&:to_i) | |
goal << g | |
f = gets.strip.split(/\s+/).map(&:to_i) | |
foul << f | |
end | |
for y in 0...goal.length do | |
for x in 0...goal[y].length do | |
seg << (goal[y][x]*20) - (foul[y][x]*10) | |
end | |
points << seg | |
seg= [] | |
end | |
points.each do |i| | |
i.max > 0 ? (p i.max) : (p 0) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment