Skip to content

Instantly share code, notes, and snippets.

@Yachida
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save Yachida/61de7a7ac069f9e3e637 to your computer and use it in GitHub Desktop.

Select an option

Save Yachida/61de7a7ac069f9e3e637 to your computer and use it in GitHub Desktop.
硬貨における強制通用力の上限
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