Skip to content

Instantly share code, notes, and snippets.

@ffloyd
Created August 1, 2014 22:58
Show Gist options
  • Save ffloyd/f9c4d35aeb4381b16d0f to your computer and use it in GitHub Desktop.
Save ffloyd/f9c4d35aeb4381b16d0f to your computer and use it in GitHub Desktop.
Solution
object Problem1001 {
def main(args: Array[String]) {
val numbersStrings = io.Source.stdin.getLines()
val squares = numbersStrings.flatMap {
_.split(" ").filterNot { _.isEmpty }.map { x => math.sqrt(x.toLong) }
}.toArray.reverse
println(squares.mkString("\n"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment