Ruby programs are executed on the server with the Ruby 1.9.3. The syntax is checked with command: ruby -c %1
. Interpreter is invoked without parameters: ruby %1
.
You can find the interpreter here.
An example of solving a problem
A sample solution for the 1000. A + B problem in Ruby:
a, b = gets.split(" ").map {|x| x.to_i}
puts (a + b)
A sample solution for the 1001. Reverse Root in Ruby:
tokens = []
while string = gets do
string.split().each do |token|
tokens << token
end
end
tokens.reverse.each do |token|
puts (token.to_i ** 0.5).round(4)
end