CTDL&GT bài 2.A29 CTDL&GT bài Số Fibonacci 1


LÀM BÀI

Points: 10 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Số Fibonacci 1

Đề bài

Dãy số Fibonacci được định nghĩa như sau:

  • F₁ = 0
  • F₂ = 1
  • Fᵢ = Fᵢ₋₁ + Fᵢ₋₂ với i ≥ 3

Hãy viết chương trình in ra số Fibonacci thứ n.

Input Format

  • Một số nguyên dương n (1 ≤ n ≤ 93)

Constraints

  • Time limit: 1s
  • Memory limit: 100MB

Output Format

  • In ra số Fibonacci thứ n

Sample

Sample Input 0
5
Sample Output 0
3

Giải thích

  • F₁ = 0
  • F₂ = 1
  • F₃ = F₂ + F₁ = 1
  • F₄ = F₃ + F₂ = 2
  • F₅ = F₄ + F₃ = 3

Comments

There are no comments at the moment.

Zalo