fork(2) download
  1. object Main {
  2. def main(args: Array[String]): Unit = {
  3. val start = System.nanoTime()
  4. val max = 1000000L
  5. val a = Seq.range(0L, max, 2L)
  6. val b = Seq.range(max, 0L, -2L)
  7. val dot = a.zip(b).map(x => x._1 * x._2).sum
  8. val end = System.nanoTime()
  9. println(dot)
  10. println((end.toDouble - start.toDouble)/math.pow(10, 9))
  11. }
  12. }
  13.  
Success #stdin #stdout 1.91s 322944KB
stdin
Standard input is empty
stdout
83333333333000000
1.791996195