Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created September 9, 2018 05:56
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/adab8fd2c50fc7c1f18483ffbb1ad93e to your computer and use it in GitHub Desktop.
Save whatalnk/adab8fd2c50fc7c1f18483ffbb1ad93e to your computer and use it in GitHub Desktop.
AtCoder ABC #109 C
n, x = gets.chomp.split(" ").map(&:to_i)
xx = gets.chomp.split(" ").map(&:to_i)
nx = xx.map{|e| (x - e).abs}.sort
d = nx.shift
nx.each do |e|
d = d.gcd(e)
end
puts d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment