Skip to content

Instantly share code, notes, and snippets.

@manojnaidu619
Created August 2, 2019 10:01
Show Gist options
  • Save manojnaidu619/91e70fcdaed3d8f621b7749399eceeda to your computer and use it in GitHub Desktop.
Save manojnaidu619/91e70fcdaed3d8f621b7749399eceeda to your computer and use it in GitHub Desktop.
Codechef solution for problem "Football" (problem code: MSNSADM1) in Ruby
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