gets a = gets.split.map(&:to_i) sum = a.inject(&:+) / (a.size - 1) #鶴亀の足の合計 k = (sum - 2 * a.size) / 2 t = a.size - k puts "#{t} #{k}"