Scala programs are compiled on the server by the Scala 2.11.2. The compiler is invoked with the following parameters:
scalac -optimise -feature %1
Solutions are executed by the Java 8 interpreter:
java -client -Xmx544m -Xss64m -DONLINE_JUDGE
-classpath .;scala-library.jar YourClassName
You can find the compiler here.
Examples of solving problems
A sample solution for the 1000. A + B problem in Scala:
object Main extends App {
println(readLine().split(" ").map(_.toInt).sum)
}
You can also use standard JDK classes:
import java.util.Scanner
object Sum {
def main(args: Array[String]) {
val in = new Scanner(System.in)
println(in.nextInt() + in.nextInt())
in.close()
}
}
A sample solution for the 1001. Reverse Root in Scala:
import io.Source
object ReverseRoot extends App {
val longs = Source.stdin.getLines().flatMap(
_.split(" ").filter(!_.isEmpty).map(_.toLong)).toArray
println(longs.reverse.map(t => math.sqrt(t)).mkString("\n"))
}
Earlier compilers
- The Scala 2.10.1 was used until October, 3 2014.