Skip to content

Instantly share code, notes, and snippets.

@kazua
Last active December 10, 2015 11:08
Show Gist options
  • Save kazua/4425146 to your computer and use it in GitHub Desktop.
Save kazua/4425146 to your computer and use it in GitHub Desktop.
年の中に同じ数値が現れない年
//K.A
//年の中に同じ数値が現れない年のリスト
object yeardiff {
def yeardiff(maxyear : Int) : Seq[String] = {
(1 to maxyear).map(_.toString.toList).filter(a => a.distinct.size == a.size).map(_.mkString)
}
def main(args : Array[String]) {
val nowyear = 2013
yeardiff(nowyear).foreach(println)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment