Skip to content

Instantly share code, notes, and snippets.

@brianhsu
Created February 8, 2010 04:41
Show Gist options
  • Save brianhsu/297882 to your computer and use it in GitHub Desktop.
Save brianhsu/297882 to your computer and use it in GitHub Desktop.
import scala.io.Source
object Main
{
def fact (i: BigInt): BigInt = if (i == 1) return 1 else i * fact(i-1)
def main (args: Array[String]) {
val list = Source.fromInputStream(System.in).getLines.
toList.map(_.trim.toInt)
val result = list.tail.take(list.head).map (x => fact(x))
result.foreach (println _)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment