문제 링크 (opens new window)

# 풀이

import Foundation

let input = Int(readLine()!)!
var fibos: [Int] = [0, 1]

func fibonacci(n: Int) -> Int {
    if n == 0 {
        return 0
    }
    if n == 2 || n == 1 {
        return 1
    }
    return fibonacci(n: n-1) + fibonacci(n: n-2)
}

var count = 2
while count <= input {
    fibos.append(fibonacci(n: count))
    count = fibos.count
}
print(fibos[input])