Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created April 6, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/b98d7cc5cf2ca546a81746f40962835c to your computer and use it in GitHub Desktop.
Save whatalnk/b98d7cc5cf2ca546a81746f40962835c to your computer and use it in GitHub Desktop.
AtCoder ABC #123 B - Five Dishes
a = []
b = []
5.times do
x = gets.chomp.to_i
if x % 10 == 0
a << x
else
b << x
end
end
b.sort_by!{|x| x % 10}
ret = 0
ret += a.inject(:+) unless a.empty?
x = b.shift
ret += x unless x.nil?
b.each do |x|
ret += (x / 10 + 1) * 10
end
puts ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment