fork download
  1. import scala.math.{pow}
  2. val n = List(0, 3, 5, 6)
  3. val a = n ++ n.reverse.map( 15 - _ )
  4. val b = List.range(0, 15) diff a
  5. def | = { s:List[Any] => "[" + s.mkString(", ") + "] " }
  6. print(|(a)); println(|(b))
  7. for(p <- 0 to 3) {
  8. val ai = a.map( pow(_,p) ).sum
  9. val bi = b.map( pow(_,p) ).sum
  10. List(ai,bi).map( d => print("%5s".format(d.toInt)))
  11. println
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.scala:2: error: expected class or object definition
val n = List(0, 3, 5, 6)
^
Main.scala:3: error: expected class or object definition
val a = n ++ n.reverse.map( 15 - _ )  
^
Main.scala:4: error: expected class or object definition
val b = List.range(0, 15) diff a
^
Main.scala:5: error: expected class or object definition
def | = { s:List[Any] => "[" + s.mkString(", ") + "] " }
^
Main.scala:6: error: expected class or object definition
print(|(a)); println(|(b))
^
Main.scala:6: error: expected class or object definition
print(|(a)); println(|(b))
             ^
Main.scala:7: error: expected class or object definition
for(p <- 0 to 3) {
^
7 errors found
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty