Created
September 1, 2018 15:53
-
-
Save whatalnk/0667cfb5f7edfe3817d28ae201f2bd5f to your computer and use it in GitHub Desktop.
AtCoder ABC #108 C
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, k = gets.chomp.split(" ").map(&:to_i) | |
a = n / k | |
if k.odd? | |
puts a**3 | |
else | |
b = k / 2 | |
if n - k * a >= b | |
puts a**3 + (a + 1)**3 | |
else | |
puts (a**3) * 2 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment