Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created October 17, 2018 03:09
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/ba200ea817f0aa28cbf1539830e0ef27 to your computer and use it in GitHub Desktop.
Save whatalnk/ba200ea817f0aa28cbf1539830e0ef27 to your computer and use it in GitHub Desktop.
ABC #094 D. Binomial Coefficients
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
amax = a.max
amid = amax / 2.0
r = a.sort{|a, b| (a - amid).abs <=> (b - amid).abs}[0]
if n == 2
puts "#{a.max} #{a.min}"
else
puts "#{amax} #{r}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment