Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created March 21, 2018 04:10
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/5bb1f8b3a087bda9e64b4b09a00910ff to your computer and use it in GitHub Desktop.
Save whatalnk/5bb1f8b3a087bda9e64b4b09a00910ff to your computer and use it in GitHub Desktop.
AtCoder AGC #004 A. Divide a Cuboid
a, b, c = gets.chomp.split(" ").map(&:to_i)
total = a * b * c
r1 = (a / 2) * b * c
b1 = total - r1
r2 = a * (b / 2) * c
b2 = total - r2
r3 = a * b * (c / 2)
b3 = total - r3
puts [(r1 - b1).abs, (r2 - b2).abs, (r3 - b3).abs].min
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment