Last active
August 29, 2015 14:13
-
-
Save Yachida/61de7a7ac069f9e3e637 to your computer and use it in GitHub Desktop.
硬貨における強制通用力の上限
This file contains hidden or 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
| object legalTender extends App { | |
| val yenCoins = List(1 | |
| ,5 | |
| ,10 | |
| ,50 | |
| ,100 | |
| ,500) | |
| val yenMax = 20 | |
| def sumCoins(coins: List[Int], max: Int): Int = coins.map(_ * max).sum | |
| println(sumCoins(yenCoins, yenMax)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment