Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created February 4, 2018 12:36
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/a740f880798e976855ec44b6b3323671 to your computer and use it in GitHub Desktop.
Save whatalnk/a740f880798e976855ec44b6b3323671 to your computer and use it in GitHub Desktop.
AtCoder APC #001 A
x, y = gets.chomp.split(" ").map(&:to_i)
if x % y == 0 then
puts -1
exit
end
n = x * y + x
if n > 10**18 then
puts -1
else
puts n
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment