# AtCoder Regular Contest 051

URL: https://atcoder.jp/contests/arc051 (opens new window)

# B

k = gets.chomp.to_i

a = 1
b = 1
count = 0

while count < k do
  # 互除法を逆にたどる
  # a % b = r
  r = b
  b = a
  a = b + r
  count += 1
end

puts "#{a} #{b}"
Last Updated: 2020/08/09 18:33