Skip to content

Instantly share code, notes, and snippets.

@Yachida
Yachida / legalTender.scala
Last active August 29, 2015 14:13
硬貨における強制通用力の上限
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
@Yachida
Yachida / dateCheck.scala
Created January 6, 2015 08:50
逆から読んでも日付になる4桁の数値
import java.text._
object dateCheck extends App {
def isDate(str: String): Boolean = {
val d = new SimpleDateFormat("yyyyMMdd")
d.setLenient(false)
try {
d.parse("2000"+str)
true
} catch {