Created
October 17, 2018 03:09
-
-
Save whatalnk/ba200ea817f0aa28cbf1539830e0ef27 to your computer and use it in GitHub Desktop.
ABC #094 D. Binomial Coefficients
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
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