I didn't know how to calculate by inputting half-width space in standard input due to paizaD rank problem, so memo
ruby.rb
s = gets.split(' ').map(&:to_i) #Create an array with split half-width and map(&:to_i)Change to a numerical value with
result = s[0] + s[1] #Add the numbers in the array
puts result
Until now, I had only solved the problem separated by line breaks, so I didn't know how to input two half-width characters with standard input. It is important to solidify the foundation.
Recommended Posts