-
-
Save segomin/d5a603123f8cd17e61daa4c65d9ac88d to your computer and use it in GitHub Desktop.
Algorithmic PS
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
@main def main(): Unit = { | |
val emptyBox = 102 | |
val bigBox = 11 | |
val product = 8 | |
def emptyCount(bigBox: Int, product: Int, emptyBoxes: Int): Int = { | |
(emptyBoxes - bigBox) / (product - 1) | |
} | |
def totalCount(bigBox: Int, product: Int, newBoxCount: Int): Int = { | |
(newBoxCount * product) + bigBox | |
} | |
val newBoxes = emptyCount(bigBox, product, emptyBox) | |
val total = totalCount(bigBox, product, newBoxes) | |
println(s"Middle and small boxes: $newBoxes") | |
println(s"Total: $total") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment