Rubyのタイピング
問題文
($n = gets.to_i)
$n = gets.to_i
($v = gets.split(” ”).map(&:to_i))
$v = gets.split(" ").map(&:to_i)
($c = gets.split(” ”).map(&:to_i))
$c = gets.split(" ").map(&:to_i)
(def rec(i))
def rec(i)
(res = 0)
res = 0
(if i == $n)
if i == $n
(res = 0)
res = 0
(else)
else
(end)
end
(end)
end
(puts rec(0))
puts rec(0)
(count = gets.to_i)
count = gets.to_i
(head = [])
head = []
(tail = [])
tail = []
(nums = gets.split.map(&:to_i))
nums = gets.split.map(&:to_i)
(nums.each{|n|)
nums.each{|n|
(})
}
(nums.reverse_each{|n|)
nums.reverse_each{|n|
(})
}
(tail.reverse!)
tail.reverse!
(last_index = count - 1)
last_index = count - 1
(puts (0..last_index).map{|index|)
puts (0..last_index).map{|index|
(if index == 0)
if index == 0
(tail[1])
tail[1]
(elsif index == last_index)
elsif index == last_index
(head[last_index -1])
head[last_index -1]
(else)
else
(head[index - 1].gcd(tail[index + 1]))
head[index - 1].gcd(tail[index + 1])
(end)
end
(}.max)
}.max