Aizu Onine Judge

This article is created as a memorandum so that you will not forget what you learned while working on the Aizu Online Judge.

gets (accepts string input)

name = gets
#Enter Taro and enter
#=>"Taro\n"
name = gets.chomp
#Enter Taro and enter
#=>"Taro"
number = gets.to_i
#Enter 1
#=>1 

gets is a string

join

Concatenate arrays and return as a single string

[1,2,3].join  
#"abc"
[1,2,3].join(" ")
#"a b c"
[1,2,3].join("+")
#"1+2+3"

repetition

times

1000.times do
  puts "Hello World"
end

Recommended Posts

Aizu Onine Judge