ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

How to write Ruby solutions

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