Witam piszę języku Ruby, program zwraca poprawne wyniki dla przykładowych wejść

4
2 3
3 3
999 999
333 333

result_array = Array.new
index = gets.to_i
if index >= 1 && index <= 10
(1..index).each do |j|
a, b = gets.split.map(&:to_i) #a => number, b => exponent
if a >= 1 && b >= 1 && a <= 1000000000 && b <= 1000000000
result = a**(b%4)%10
result_array.push(result)
end
end
puts result_array
end

  • created

    Feb '17
  • last reply

    Feb '17
  • 1

    reply

  • 430

    views

  • 2

    users