0053デフォルトの名無しさん垢版 | 大砲2020/03/28(土) 00:46:37.28ID:xGS8Imsw >>52 Ruby def anka(str) nums=[] str.split(“,”).each do |s| x,y=s.split(“-“) if y nums+=(x.to_i .. y.to_i).to_a else nums<<x.to_i end end return nums end anka(“1,3-5”) #=> [1,3,4,5]